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.1~1^2~39 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=9e42188e79377946c9d5c197abfb58ad88d7baae 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/libelogind/sd-daemon/sd-daemon.c b/src/libelogind/sd-daemon/sd-daemon.c index 3ea9764c4..e47da68a6 100644 --- a/src/libelogind/sd-daemon/sd-daemon.c +++ b/src/libelogind/sd-daemon/sd-daemon.c @@ -595,7 +595,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; }