From 2cf3d796a857c2b814e5ad077a4dfbf12f2b43d6 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Mon, 29 Dec 2014 19:07:29 +0000 Subject: Fix case where interval overflows (thanks jackeri) [17:58] hey, you might be interested in checking out this https://github.com/etlegacy/etlegacy/commit/4da5a397b5994bfe5fddb9dad35bef5ddbea64c9#diff-acaedc9d8b492f9af8966ae68597392cR615 [17:58] its related to the ddos protection code you wrote [17:59] in continuation to: ab9b08e5845b0ff19814c996ad0cfb1dccab2790 [17:59] 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] since in that case if the bucket of that clients ip still exists it wont get checked correctly --- src/server/sv_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') 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 { -- cgit