Commit a6f05267 by Christian Brauner Committed by Stéphane Graber

Check return value of snprintf in mount_proc_if_needed()

parent b3a9fe8b
...@@ -1664,6 +1664,10 @@ int mount_proc_if_needed(const char *rootfs) ...@@ -1664,6 +1664,10 @@ int mount_proc_if_needed(const char *rootfs)
mypid = (int)getpid(); mypid = (int)getpid();
INFO("I am %d, /proc/self points to '%s'", mypid, link); INFO("I am %d, /proc/self points to '%s'", mypid, link);
ret = snprintf(path, MAXPATHLEN, "%s/proc", rootfs); 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 */ if (linklen < 0) /* /proc not mounted */
goto domount; goto domount;
if (atoi(link) != mypid) { if (atoi(link) != mypid) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment