1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-08 05:57:26 +03:00

ratelimit: fix integer overflow

If StartLimitIntervalSec is huge, or more specifically, set to "infinity", we need to take care about overflows.

(cherry picked from commit e2357b1c8a87b610066b8b2a59517bcfb20b832e)
This commit is contained in:
Etienne Doms 2020-11-12 11:09:54 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent 821937ffc8
commit c5805e39c5

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