mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-27 09:48:32 +00:00
network: adhere to IFNAMSIZ limit
The additional \0-byte space added is not needed since IFNAMSIZ needs to include the \0-byte. Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
def4def6fd
commit
095ead8051
@ -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
|
|||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user