]> source.dussan.org Git - rspamd.git/commitdiff
Do not set negative values for ratelimits.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 26 Feb 2015 14:52:23 +0000 (14:52 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 26 Feb 2015 14:52:23 +0000 (14:52 +0000)
src/plugins/lua/ratelimit.lua

index 0dd9b84049da89b753e0a1c0fb554accf06f8f32..c816e12ca61abc010637a877e900a2096eec8175 100644 (file)
@@ -166,6 +166,9 @@ local function set_limits(task, args)
         
         if bucket > 0 then
           bucket = bucket - rate * (ntime - atime) + 1;
+          if bucket < 0 then
+            bucket = 1
+          end
         else
           bucket = 1
         end