]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-daemon: explicitly filter out -1 when parsing watchdog timeout
authorLennart Poettering <lennart@poettering.net>
Tue, 3 Nov 2015 11:27:12 +0000 (12:27 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 3 Nov 2015 16:45:12 +0000 (17:45 +0100)
We already filter out 0, and as -1 is usually special (meaning infinity,
as in USEC_INFINITY) we should better not accept it either. Better safe
than sorry...

src/libsystemd/sd-daemon/sd-daemon.c

index 27045e25d0c583a1131ddfdf95b6b1d9e0d0ece1..a48fa05908764bb0c6993eda744b1650fd0bf6c3 100644 (file)
@@ -586,7 +586,7 @@ _public_ int sd_watchdog_enabled(int unset_environment, uint64_t *usec) {
         r = safe_atou64(s, &u);
         if (r < 0)
                 goto finish;
-        if (u <= 0) {
+        if (u <= 0 || u >= USEC_INFINITY) {
                 r = -EINVAL;
                 goto finish;
         }