]> git.proxmox.com Git - mirror_lxc.git/commitdiff
coverity: #1426126
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 8 Feb 2018 14:47:32 +0000 (15:47 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 9 Feb 2018 09:37:49 +0000 (10:37 +0100)
Unchecked return value

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/start.c

index 1cbfcae35bb0a5f8c38f8a261a140edbcbf8ae0a..6987501e5a2821438fee2cb4c755439dc96bb79d 100644 (file)
@@ -1657,7 +1657,10 @@ static int lxc_spawn(struct lxc_handler *handler)
                DEBUG("Preserved cgroup namespace via fd %d", ret);
        }
 
-       snprintf(pidstr, 20, "%d", handler->pid);
+       ret = snprintf(pidstr, 20, "%d", handler->pid);
+       if (ret < 0 || ret >= 20)
+               goto out_delete_net;
+
        if (setenv("LXC_PID", pidstr, 1))
                SYSERROR("Failed to set environment variable: LXC_PID=%s.", pidstr);