]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add shrinking failsafety
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 1 May 2019 15:49:23 +0000 (16:49 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 1 May 2019 15:49:23 +0000 (16:49 +0100)
src/lua/lua_common.c

index b83b68bf0799f8f92fc432a206283a11292fe30e..5f25d837de42dcbc368e8e7dd3a97c6eba8ee77a 100644 (file)
@@ -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);
        }