Skip to content

Commit

Permalink
Check return value of snprintf in mount_proc_if_needed()
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
  • Loading branch information
brauner authored and stgraber committed Sep 29, 2015
1 parent b3a9fe8 commit a6f0526
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lxc/utils.c
Expand Up @@ -1664,6 +1664,10 @@ int mount_proc_if_needed(const char *rootfs)
mypid = (int)getpid();
INFO("I am %d, /proc/self points to '%s'", mypid, link);
ret = snprintf(path, MAXPATHLEN, "%s/proc", rootfs);
if (ret < 0 || ret >= MAXPATHLEN) {
SYSERROR("proc path name too long");
return -1;
}
if (linklen < 0) /* /proc not mounted */
goto domount;
if (atoi(link) != mypid) {
Expand Down

0 comments on commit a6f0526

Please sign in to comment.