From: Christian Brauner Date: Sat, 26 Aug 2017 22:48:34 +0000 (+0200) Subject: conf: do not deref null pointer X-Git-Tag: lxc-2.0.9~49^2~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=291e454c9ae3a2dd2979f0f43b8f573db0f7adaf;p=thirdparty%2Flxc.git conf: do not deref null pointer Signed-off-by: Christian Brauner --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index afc1af9f5..0105eaec0 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -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); }