]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Filter bad utf8 subjects
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 9 Apr 2017 09:46:51 +0000 (10:46 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 9 Apr 2017 09:46:51 +0000 (10:46 +0100)
src/plugins/lua/history_redis.lua

index 13e780e523151881d48e768036d71628a6f82597..1564f467c2d9c9e96c567a24d281b49e40f278bc 100644 (file)
@@ -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)