From 6578d0af4873ee989969b4a87afce850d5b527e5 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Sun, 13 Jan 2008 15:19:59 +0000 Subject: [PATCH] Fixed reallocation when reducing size. --- lib/silcutil/silcmemory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.24.0