]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add wipe flag for rspamd_text lua object
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 26 Apr 2019 13:03:19 +0000 (14:03 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 26 Apr 2019 13:03:19 +0000 (14:03 +0100)
src/lua/lua_common.h
src/lua/lua_task.c

index 3157c565e1519a1a5116cc4488638b868de70502..d9bbff585176c8c22ed99adb0b1ff9529e92b33e 100644 (file)
@@ -65,8 +65,9 @@ struct rspamd_lua_ip {
        rspamd_inet_addr_t *addr;
 };
 
-#define RSPAMD_TEXT_FLAG_OWN (1 << 0)
-#define RSPAMD_TEXT_FLAG_MMAPED (1 << 1)
+#define RSPAMD_TEXT_FLAG_OWN (1u << 0u)
+#define RSPAMD_TEXT_FLAG_MMAPED (1u << 1u)
+#define RSPAMD_TEXT_FLAG_WIPE (1u << 2u)
 struct rspamd_lua_text {
        const gchar *start;
        guint len;
index 5fe7db5569865682ef7ef9bed756ea774ca45672..50e35434cefa4a7a1f1d63298abac14e5fe5dcf9 100644 (file)
@@ -6232,6 +6232,10 @@ lua_text_gc (lua_State *L)
 
        if (t != NULL) {
                if (t->flags & RSPAMD_TEXT_FLAG_OWN) {
+                       if (t->flags & RSPAMD_TEXT_FLAG_WIPE) {
+                               rspamd_explicit_memzero ((guchar *)t->start, t->len);
+                       }
+
                        if (t->flags & RSPAMD_TEXT_FLAG_MMAPED) {
                                munmap ((gpointer)t->start, t->len);
                        }