commit 59cfa81: [Minor] Add shrinking failsafety

Vsevolod Stakhov vsevolod at highsecure.ru
Wed May 1 15:56:03 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-05-01 16:49:23 +0100
URL: https://github.com/rspamd/rspamd/commit/59cfa81d517303d6159e5abb24db26bef1104c21 (HEAD -> master)

[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);
 	}
 


More information about the Commits mailing list