diff options
author | Tim Angus <tim@ngus.net> | 2014-12-29 19:07:29 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2015-03-17 11:39:12 +0000 |
commit | 2cf3d796a857c2b814e5ad077a4dfbf12f2b43d6 (patch) | |
tree | d816386542bf0ebfcca29c26645da00af1f513ff /src/server | |
parent | aeaff8c13765b96daae31311b2f3d3ade3087322 (diff) |
Fix case where interval overflows (thanks jackeri)
[17:58] <Jacker> hey, you might be interested in checking out this
https://github.com/etlegacy/etlegacy/commit/4da5a397b5994bfe5fddb9dad35bef5ddbea64c9#diff-acaedc9d8b492f9af8966ae68597392cR615
[17:58] <Jacker> its related to the ddos protection code you wrote
[17:59] <Jacker> in continuation to:
ab9b08e5845b0ff19814c996ad0cfb1dccab2790
[17:59] <Jacker> in a case if the client has in the past connected to
the server days/weeks earlier and time wraps the client wont be able to
connect
[18:00] <Jacker> since in that case if the bucket of that clients ip
still exists it wont get checked correctly
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/sv_main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/server/sv_main.c b/src/server/sv_main.c index aad063e2..77d1a35d 100644 --- a/src/server/sv_main.c +++ b/src/server/sv_main.c @@ -501,7 +501,7 @@ qboolean SVC_RateLimit( leakyBucket_t *bucket, int burst, int period ) { int expired = interval / period; int expiredRemainder = interval % period; - if ( expired > bucket->burst ) { + if ( expired > bucket->burst || interval < 0 ) { bucket->burst = 0; bucket->lastTime = now; } else { |