Unverified Commit 503c7837 by Stéphane Graber Committed by GitHub

Merge pull request #2314 from brauner/2018-05-11/compiler_fixes

gcc-8: silence
parents 3d36e44a 095ead80
...@@ -2089,7 +2089,7 @@ static int lxc_create_network_unpriv_exec(const char *lxcpath, const char *lxcna ...@@ -2089,7 +2089,7 @@ static int lxc_create_network_unpriv_exec(const char *lxcpath, const char *lxcna
pid_t child; pid_t child;
int bytes, pipefd[2]; int bytes, pipefd[2];
char *token, *saveptr = NULL; char *token, *saveptr = NULL;
char netdev_link[IFNAMSIZ + 1]; char netdev_link[IFNAMSIZ];
char buffer[MAXPATHLEN] = {0}; char buffer[MAXPATHLEN] = {0};
if (netdev->type != LXC_NET_VETH) { if (netdev->type != LXC_NET_VETH) {
...@@ -2127,9 +2127,9 @@ static int lxc_create_network_unpriv_exec(const char *lxcpath, const char *lxcna ...@@ -2127,9 +2127,9 @@ static int lxc_create_network_unpriv_exec(const char *lxcpath, const char *lxcna
} }
if (netdev->link[0] != '\0') if (netdev->link[0] != '\0')
strncpy(netdev_link, netdev->link, IFNAMSIZ); strncpy(netdev_link, netdev->link, IFNAMSIZ - 1);
else else
strncpy(netdev_link, "none", IFNAMSIZ); strncpy(netdev_link, "none", IFNAMSIZ - 1);
ret = snprintf(pidstr, LXC_NUMSTRLEN64, "%d", pid); ret = snprintf(pidstr, LXC_NUMSTRLEN64, "%d", pid);
if (ret < 0 || ret >= LXC_NUMSTRLEN64) if (ret < 0 || ret >= LXC_NUMSTRLEN64)
...@@ -2178,8 +2178,8 @@ static int lxc_create_network_unpriv_exec(const char *lxcpath, const char *lxcna ...@@ -2178,8 +2178,8 @@ static int lxc_create_network_unpriv_exec(const char *lxcpath, const char *lxcna
return -1; return -1;
} }
memset(netdev->name, 0, IFNAMSIZ + 1); memset(netdev->name, 0, IFNAMSIZ);
strncpy(netdev->name, token, IFNAMSIZ); memcpy(netdev->name, token, IFNAMSIZ - 1);
/* netdev->ifindex */ /* netdev->ifindex */
token = strtok_r(NULL, ":", &saveptr); token = strtok_r(NULL, ":", &saveptr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment