From 9e42188e79377946c9d5c197abfb58ad88d7baae Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 3 Nov 2015 12:27:12 +0100 Subject: [PATCH] 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... --- src/libelogind/sd-daemon/sd-daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 2.30.2