]> 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>
Tue, 29 Sep 2015 16:38:58 +0000 (12:38 -0400)
Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/utils.c

index 5250c621706ab2877ab9ff7bf1ad908c68635470..788cbe136302bb46a559c36dc45a895f8c584574 100644 (file)
@@ -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) {