From e633e923d3f45af8e0142f04fbae08e0e1d5e0ca Mon Sep 17 00:00:00 2001 From: Aleksey Manevich Date: Tue, 6 Sep 2016 01:19:41 +0300 Subject: fix read_pid --- src/firejail/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/firejail/main.c b/src/firejail/main.c index 94000d917..569fc7add 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c @@ -161,7 +161,8 @@ static inline int read_pid(char *str, pid_t *pid) { || (errno != 0 && pidtmp == 0)) { return 1; } - if (endptr == str) { + // endptr points to '\0' char in str if the entire string is valid + if (endptr == NULL || endptr[0]!='\0') { return 1; } *pid = (pid_t)pidtmp; -- cgit v1.2.3-70-g09d2