From e1be9119f8dc6d8303d657a2536d4ecaef216f3b Mon Sep 17 00:00:00 2001 From: paco Date: Wed, 13 Jun 2018 16:33:51 +0200 Subject: [PATCH] tools: out-of-bounds access (Coverity 1399290) Signed-off-by: F. Aragon --- tools/start-stop-daemon.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/start-stop-daemon.c b/tools/start-stop-daemon.c index 6bf55b7740..5f13b90be3 100644 --- a/tools/start-stop-daemon.c +++ b/tools/start-stop-daemon.c @@ -258,11 +258,11 @@ static void add_namespace(const char *path) nsname = cur; } - if (!memcmp(nsdirname, "ipcns/", strlen("ipcns/"))) + if (!strncmp(nsdirname, "ipcns/", strlen("ipcns/"))) nstype = CLONE_NEWIPC; - else if (!memcmp(nsdirname, "netns/", strlen("netns/"))) + else if (!strncmp(nsdirname, "netns/", strlen("netns/"))) nstype = CLONE_NEWNET; - else if (!memcmp(nsdirname, "utcns/", strlen("utcns/"))) + else if (!strncmp(nsdirname, "utcns/", strlen("utcns/"))) nstype = CLONE_NEWUTS; else badusage("invalid namepspace path"); -- 2.39.5