From: Vsevolod Stakhov Date: Fri, 1 Jul 2022 20:31:15 +0000 (+0100) Subject: [Feature] Check content for binary stuff before dumping it to Lua X-Git-Tag: 3.3~154 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d87f4e9f5759b4cb85072b422d353cea1437df54;p=rspamd.git [Feature] Check content for binary stuff before dumping it to Lua Issue: #4204 --- diff --git a/src/lua/lua_mimepart.c b/src/lua/lua_mimepart.c index 27b12ae6d..ae959c34e 100644 --- a/src/lua/lua_mimepart.c +++ b/src/lua/lua_mimepart.c @@ -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; } diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 26cb7e1e9..ed7ebcbea 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -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");