]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Avoid nan poisoning in ip_score
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 25 Jan 2017 13:28:57 +0000 (13:28 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 25 Jan 2017 13:28:57 +0000 (13:28 +0000)
src/plugins/lua/ip_score.lua

index e7cd9079ffb50216832ec285083fcb6cde5db0ee..fed38033e01ec0c13f417177285c9b6751ac9c0b 100644 (file)
@@ -94,12 +94,16 @@ end
 local ip_score_set = function(task)
   local function new_score_set(score, old_score, old_total)
     local new_total
-    if old_total == -1 then
+    if old_total == -1 or old_total ~= old_total then
       new_total = 1
     else
       new_total = old_total + 1
     end
 
+    if score ~= score then
+      score = 0
+    end
+
     return old_score + score, new_total
   end