Skip to content

Commit f753f30

Browse files
Merge pull request #1779 from runcom/gcc8-fix
nsexec.c: fix GCC 8 warning
2 parents 9f0eca2 + 1a50646 commit f753f30

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libcontainer/nsenter/nsexec.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,8 @@ void join_namespaces(char *nslist)
505505

506506
ns->fd = fd;
507507
ns->ns = nsflag(namespace);
508-
strncpy(ns->path, path, PATH_MAX);
508+
strncpy(ns->path, path, PATH_MAX - 1);
509+
ns->path[PATH_MAX - 1] = '\0';
509510
} while ((namespace = strtok_r(NULL, ",", &saveptr)) != NULL);
510511

511512
/*

0 commit comments

Comments
 (0)