]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Sanitize IP in history redis
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 10 Jan 2018 19:17:10 +0000 (19:17 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 10 Jan 2018 19:21:39 +0000 (19:21 +0000)
src/plugins/lua/history_redis.lua

index 6e26bc06fefe629f5aec33b3e0028db7e6eb7076..abeadc801e4d5d1ff1adbb28f5292e96618cd931 100644 (file)
@@ -75,7 +75,13 @@ local function normalise_results(tbl, task)
 
   tbl.subject = task:get_header('subject') or 'unknown'
   tbl.size = task:get_size()
-  tbl.ip = tostring(task:get_from_ip() or 'unknown')
+  local ip = task:get_from_ip()
+  if ip and ip:is_valid() then
+    tbl.ip = tostring(ip)
+  else
+    tbl.ip = 'unknown'
+  end
+
   tbl.user = task:get_user() or 'unknown'
 end