From: paco Date: Wed, 13 Jun 2018 14:33:51 +0000 (+0200) Subject: tools: out-of-bounds access (Coverity 1399290) X-Git-Tag: frr-6.1-dev~331^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F2431%2Fhead;p=mirror%2Ffrr.git tools: out-of-bounds access (Coverity 1399290) Signed-off-by: F. Aragon --- 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");