From d87f4e9f5759b4cb85072b422d353cea1437df54 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 1 Jul 2022 21:31:15 +0100 Subject: [PATCH] [Feature] Check content for binary stuff before dumping it to Lua Issue: #4204 --- src/lua/lua_mimepart.c | 4 ++++ src/lua/lua_task.c | 4 ++++ 2 files changed, 8 insertions(+) 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"); -- 2.39.5