]> 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)
committerAndrew Lewis <nerf@judo.za.org>
Wed, 24 Jan 2018 12:11:52 +0000 (14:11 +0200)
src/plugins/lua/history_redis.lua

index ad65184b927626043d3bfb8ce0a2a4d5e1f290e7..8489c26f0a22815a250086b179928aee0dcf69ae 100644 (file)
@@ -73,7 +73,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