commit d87f4e9: [Feature] Check content for binary stuff before dumping it to Lua

Vsevolod Stakhov vsevolod at rspamd.com
Fri Jul 1 20:35:06 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-07-01 21:31:15 +0100
URL: https://github.com/rspamd/rspamd/commit/d87f4e9f5759b4cb85072b422d353cea1437df54 (HEAD -> master)

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


More information about the Commits mailing list