From 092940ed5bf515c1176f1315b047ac1a76ae6733 Mon Sep 17 00:00:00 2001 From: Andreas Simbuerger Date: Wed, 29 Mar 2023 18:08:57 +0200 Subject: [PATCH] fix: avoid double-dip of nrcpt when calculating ratelimit condition Before this commit, rspamd would consider the number of recipients of the current message twice when calculating the ratelimit condition. --- lualib/redis_scripts/ratelimit_check.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lualib/redis_scripts/ratelimit_check.lua b/lualib/redis_scripts/ratelimit_check.lua index aa7f564ef..1c2b32a69 100644 --- a/lualib/redis_scripts/ratelimit_check.lua +++ b/lualib/redis_scripts/ratelimit_check.lua @@ -62,7 +62,7 @@ if burst + pending > 0 then if dynb == 0 then dynb = 0.0001 end burst = burst + pending - if burst > 0 and (burst + nrcpt) > max_burst * dynb then + if burst > 0 and burst > max_burst * dynb then return {1, tostring(burst - pending), tostring(dynr), tostring(dynb), tostring(leaked)} end -- Increase pending if we allow ratelimit -- 2.39.5