From 5cf81d53e305c81517e48e0dc91620a916cdc0cc Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Fri, 12 Feb 2016 15:44:10 -0500 Subject: [PATCH] Fix: handle negative range for LTTNG_UST_REGISTER_TIMEOUT We should not consider values below -1 as valid timeout values, this is is unexpected and could lead to EINVAL errors returned by sem_timedwait. Signed-off-by: Mathieu Desnoyers --- liblttng-ust/lttng-ust-comm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index c619b544..2ada5065 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -455,6 +455,9 @@ long get_timeout(void) } if (str_timeout) constructor_delay_ms = strtol(str_timeout, NULL, 10); + /* All negative values are considered as "-1". */ + if (constructor_delay_ms < -1) + constructor_delay_ms = -1; return constructor_delay_ms; } -- 2.34.1