]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
conf: do not deref null pointer
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 26 Aug 2017 22:48:34 +0000 (00:48 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 29 Aug 2017 20:54:47 +0000 (22:54 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c

index afc1af9f56ec731d0ad334c6197b2b379a8a6128..0105eaec02b91ddc9f09a46d70df48859b886b6b 100644 (file)
@@ -3217,11 +3217,17 @@ static int unpriv_assign_nic(const char *lxcpath, char *lxcname,
                        exit(EXIT_FAILURE);
                pidstr[LXC_NUMSTRLEN64 - 1] = '\0';
 
-               INFO("Execing lxc-user-nic %s %s %s veth %s %s", lxcpath,
-                    lxcname, pidstr, netdev_link, netdev->name);
-               execlp(LXC_USERNIC_PATH, LXC_USERNIC_PATH, lxcpath, lxcname,
-                      pidstr, "veth", netdev_link, netdev->name, NULL);
-
+               INFO("Execing lxc-user-nic create %s %s %s veth %s %s", lxcpath,
+                    lxcname, pidstr, netdev_link,
+                    netdev->name ? netdev->name : "(null)");
+               if (netdev->name)
+                       execlp(LXC_USERNIC_PATH, LXC_USERNIC_PATH, "create",
+                              lxcpath, lxcname, pidstr, "veth", netdev_link,
+                              netdev->name, (char *)NULL);
+               else
+                       execlp(LXC_USERNIC_PATH, LXC_USERNIC_PATH, "create",
+                              lxcpath, lxcname, pidstr, "veth", netdev_link,
+                              (char *)NULL);
                SYSERROR("Failed to exec lxc-user-nic.");
                exit(EXIT_FAILURE);
        }