commit 092940e: fix: avoid double-dip of nrcpt when calculating ratelimit condition

Andreas Simbuerger simbuerg at fim.uni-passau.de
Thu Mar 30 17:00:03 UTC 2023


Author: Andreas Simbuerger
Date: 2023-03-29 18:08:57 +0200
URL: https://github.com/rspamd/rspamd/commit/092940ed5bf515c1176f1315b047ac1a76ae6733 (refs/pull/4448/head)

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


More information about the Commits mailing list