ratelimit: fix integer overflow

If StartLimitIntervalSec is huge, or more specifically, set to "infinity", we need to take care about overflows.
master
Etienne Doms 2 years ago committed by Lennart Poettering
parent 7a5b649fc0
commit e2357b1c8a
  1. 2
      src/basic/ratelimit.c

@ -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 */

Loading…
Cancel
Save