From 53a6f9ec822d73a83e7d1221aec1cafac8d16585 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sun, 9 Apr 2017 10:46:51 +0100 Subject: [PATCH] [Minor] Filter bad utf8 subjects --- src/plugins/lua/history_redis.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/lua/history_redis.lua b/src/plugins/lua/history_redis.lua index 13e780e52..1564f467c 100644 --- a/src/plugins/lua/history_redis.lua +++ b/src/plugins/lua/history_redis.lua @@ -163,7 +163,13 @@ local function handle_history_request(task, conn, from, to, reset) -- Parse elements using ucl data = fun.totable( fun.map(function (_, obj) return obj end, - fun.filter(function(res, obj) if res then return true end end, + fun.filter(function(res, obj) + if res and (not obj.subject or + rspamd_util.is_valid_utf8(obj.subject)) then + return true + end + return false + end, fun.map(function(elt) local parser = ucl.parser() local res,_ = parser:parse_string(elt) -- 2.39.5