]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Check content for binary stuff before dumping it to Lua
authorVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 1 Jul 2022 20:31:15 +0000 (21:31 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 1 Jul 2022 20:31:15 +0000 (21:31 +0100)
Issue: #4204

src/lua/lua_mimepart.c
src/lua/lua_task.c

index 27b12ae6d32062b607a1d37ec4a9ba01d20a591d..ae959c34e494a3ffe89b98c89a69ac51215e566d 100644 (file)
@@ -1420,6 +1420,10 @@ lua_mimepart_get_content (lua_State * L)
        t->len = part->parsed_data.len;
        t->flags = 0;
 
+       if (lua_is_text_binary(t)) {
+               t->flags |= RSPAMD_TEXT_FLAG_BINARY;
+       }
+
        return 1;
 }
 
index 26cb7e1e977783ac45405449a1db4badc0721f0f..ed7ebcbea5757c54edeb524da50c186b4aec6192 100644 (file)
@@ -2662,6 +2662,10 @@ lua_task_get_content (lua_State * L)
                t->len = task->msg.len;
                t->start = task->msg.begin;
                t->flags = 0;
+
+               if (lua_is_text_binary(t)) {
+                       t->flags |= RSPAMD_TEXT_FLAG_BINARY;
+               }
        }
        else {
                return luaL_error (L, "invalid arguments");