From: Vsevolod Stakhov Date: Wed, 1 May 2019 15:49:23 +0000 (+0100) Subject: [Minor] Add shrinking failsafety X-Git-Tag: 1.9.3~43 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=59cfa81d517303d6159e5abb24db26bef1104c21;p=rspamd.git [Minor] Add shrinking failsafety --- 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); }