From: Pekka Riikonen Date: Sun, 13 Jan 2008 15:19:59 +0000 (+0000) Subject: Fixed reallocation when reducing size. X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=6578d0af4873ee989969b4a87afce850d5b527e5 Fixed reallocation when reducing size. --- diff --git a/lib/silcutil/silcmemory.c b/lib/silcutil/silcmemory.c index b1a657b2..b7f69df8 100644 --- a/lib/silcutil/silcmemory.c +++ b/lib/silcutil/silcmemory.c @@ -155,7 +155,7 @@ void *silc_srealloc(SilcStack stack, SilcUInt32 old_size, new_ptr = silc_smalloc(stack, size); if (!new_ptr) return NULL; - memcpy(new_ptr, ptr, old_size); + memcpy(new_ptr, ptr, old_size > size ? size : old_size); } return new_ptr;