From 1a5064622c54af760b101089a0e0d27b2b88473b Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Thu, 12 Apr 2018 12:25:06 +0200 Subject: [PATCH] nsexec.c: fix GCC 8 warning Signed-off-by: Antonio Murdaca --- libcontainer/nsenter/nsexec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libcontainer/nsenter/nsexec.c b/libcontainer/nsenter/nsexec.c index 2c69cee5..030e53a7 100644 --- a/libcontainer/nsenter/nsexec.c +++ b/libcontainer/nsenter/nsexec.c @@ -505,7 +505,8 @@ void join_namespaces(char *nslist) ns->fd = fd; ns->ns = nsflag(namespace); - strncpy(ns->path, path, PATH_MAX); + strncpy(ns->path, path, PATH_MAX - 1); + ns->path[PATH_MAX - 1] = '\0'; } while ((namespace = strtok_r(NULL, ",", &saveptr)) != NULL); /*