summaryrefslogtreecommitdiff
path: root/indra/llcommon/llmemory.h
diff options
context:
space:
mode:
authorWilliam Todd Stinson <stinson@lindenlab.com>2012-10-22 11:32:46 -0700
committerWilliam Todd Stinson <stinson@lindenlab.com>2012-10-22 11:32:46 -0700
commit35eb3ed3ee723d77d72026cd35f85c5febd28916 (patch)
treeb8f68b7a026a87e94e5d7b4eed2f70e128af9b5c /indra/llcommon/llmemory.h
parent1cddc2aa27d5b6f37fc0041a46910416471aa09a (diff)
parent1b0ea26ecb82b432efd19b319116f94ce58e2b48 (diff)
Pull and merge from https://bitbucket.org/lindenlab/viewer-development.
Diffstat (limited to 'indra/llcommon/llmemory.h')
-rw-r--r--indra/llcommon/llmemory.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h
index 40cde485cf..10013e0f92 100644
--- a/indra/llcommon/llmemory.h
+++ b/indra/llcommon/llmemory.h
@@ -87,7 +87,11 @@ inline void* ll_aligned_realloc_16(void* ptr, size_t size, size_t old_size) // r
void* ret = ll_aligned_malloc_16(size);
if (ptr)
{
- memcpy(ret, ptr, old_size);
+ if (ret)
+ {
+ // Only copy the size of the smallest memory block to avoid memory corruption.
+ memcpy(ret, ptr, llmin(old_size, size));
+ }
ll_aligned_free_16(ptr);
}
return ret;