From 397a1b4bf553c8642b04cbb9e0176572afd26010 Mon Sep 17 00:00:00 2001 From: Serge Hallyn Date: Sat, 31 Jan 2015 14:09:47 +0100 Subject: [PATCH] getproctitle - check for null after last strchr Signed-off-by: Serge Hallyn --- src/lxc/utils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lxc/utils.c b/src/lxc/utils.c index 8e84678c3..f730f0cd2 100644 --- a/src/lxc/utils.c +++ b/src/lxc/utils.c @@ -1596,6 +1596,9 @@ int setproctitle(char *title) tmp = strchr(tmp+1, ' '); } + if (!tmp) + return -1; + i = sscanf(tmp, "%lu %lu %lu %lu", &arg_start, &arg_end, &env_start, &env_end); if (i != 4) { return -1; -- 2.47.3