]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Check return value of snprintf in mount_proc_if_needed()
authorChristian Brauner <christianvanbrauner@gmail.com>
Sun, 27 Sep 2015 08:32:28 +0000 (10:32 +0200)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 28 Sep 2015 19:47:20 +0000 (15:47 -0400)
Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/utils.c

index 0b83960b140db709822a56d83da9cb3f25932b03..8e7fc52f2378bf2bea26bc143e63c27538ed7d41 100644 (file)
@@ -1431,6 +1431,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) {