aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-25 13:28:57 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-25 13:28:57 +0000
commit13d62486d9d0103b214e64c389623e44e05e0813 (patch)
tree2f1aa976e7aad3b1de3a5bb92c195d389b7d1aaf /src/plugins
parentfa869e05c9b06556e90ed29048f596fc0ad9af29 (diff)
downloadrspamd-13d62486d9d0103b214e64c389623e44e05e0813.tar.gz
rspamd-13d62486d9d0103b214e64c389623e44e05e0813.zip
[Minor] Avoid nan poisoning in ip_score
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lua/ip_score.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/lua/ip_score.lua b/src/plugins/lua/ip_score.lua
index e7cd9079f..fed38033e 100644
--- a/src/plugins/lua/ip_score.lua
+++ b/src/plugins/lua/ip_score.lua
@@ -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