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:
parent
821937ffc8
commit
c5805e39c5
@ -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…
x
Reference in New Issue
Block a user