ratelimit: fix integer overflow

If StartLimitIntervalSec is huge, or more specifically, set to "infinity", we need to take care about overflows.
This commit is contained in:
Etienne Doms 2020-11-12 11:09:54 +01:00 committed by Lennart Poettering
parent 7a5b649fc0
commit e2357b1c8a
1 changed files with 1 additions and 1 deletions

View File

@ -19,7 +19,7 @@ bool ratelimit_below(RateLimit *r) {
ts = now(CLOCK_MONOTONIC);
if (r->begin <= 0 ||
r->begin + r->interval < ts) {
ts - r->begin > r->interval) {
r->begin = ts;
/* Reset counter */