From 59cfa81d517303d6159e5abb24db26bef1104c21 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 1 May 2019 16:49:23 +0100 Subject: [PATCH] [Minor] Add shrinking failsafety --- src/lua/lua_common.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c index b83b68bf0..5f25d837d 100644 --- a/src/lua/lua_common.c +++ b/src/lua/lua_common.c @@ -894,6 +894,11 @@ rspamd_lua_wipe_realloc (void *ud, return malloc (nsize); } else { + if (nsize < osize) { + /* Wipe on shrinking (actually never used) */ + rspamd_explicit_memzero (((unsigned char *)ptr) + nsize, osize - nsize); + } + return realloc (ptr, nsize); } -- 2.39.5