From: Lennart Poettering Date: Tue, 3 Nov 2015 11:27:12 +0000 (+0100) Subject: sd-daemon: explicitly filter out -1 when parsing watchdog timeout X-Git-Tag: v228~99^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=caffe412c77a662f7b856109e588b03817acc36e;p=thirdparty%2Fsystemd.git sd-daemon: explicitly filter out -1 when parsing watchdog timeout 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... --- diff --git a/src/libsystemd/sd-daemon/sd-daemon.c b/src/libsystemd/sd-daemon/sd-daemon.c index 27045e25d0c..a48fa059087 100644 --- a/src/libsystemd/sd-daemon/sd-daemon.c +++ b/src/libsystemd/sd-daemon/sd-daemon.c @@ -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; }