[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 3/3] net: tap: restrict bridge name to IFNAMSIZ
From: |
P J P |
Subject: |
[Qemu-devel] [PATCH v2 3/3] net: tap: restrict bridge name to IFNAMSIZ |
Date: |
Mon, 1 Jul 2019 14:39:04 +0530 |
From: Prasad J Pandit <address@hidden>
The interface name in Linux interface request struct 'ifreq'
OR in qemu-bridge-helper is defined to be of size IFNAMSIZ(=16),
including the terminating null('\0') byte.
QEMU tap device, while invoking qemu-bridge-helper, supplies bridge
name of 16 characters, restrict it to IFNAMESIZ-1 to accommodate
terminating null('\0') byte.
Signed-off-by: Prasad J Pandit <address@hidden>
---
net/tap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/tap.c b/net/tap.c
index e8aadd8d4b..ca8536624c 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -499,7 +499,7 @@ static int net_bridge_run_helper(const char *helper, const
char *bridge,
if (pid == 0) {
int open_max = sysconf(_SC_OPEN_MAX), i;
char fd_buf[6+10];
- char br_buf[6+IFNAMSIZ] = {0};
+ char br_buf[5+IFNAMSIZ] = {0};
char helper_cmd[PATH_MAX + sizeof(fd_buf) + sizeof(br_buf) + 15];
for (i = 3; i < open_max; i++) {
--
2.21.0