summaryrefslogtreecommitdiffstats
path: root/src/vlib/linux
diff options
context:
space:
mode:
authorStephen Hemminger <stephen@networkplumber.org>2019-01-16 10:08:39 -0800
committerDamjan Marion <dmarion@me.com>2019-01-17 09:19:47 +0000
commit29f0a5d25c208115c8d5c2b7f96062eaef205592 (patch)
tree375b09cfcda8eece2ac455594163ead03904e0ef /src/vlib/linux
parent4e8a83183e9a381d6c44fa3b94faf735d536e811 (diff)
vmbus: fix strncpy related warnings
The code that was manipulating interface names with ifreq was causing warnings about possible truncation and non terminated strings. These are warnings only since kernel would allow a interface name > 15 characters anyway. Change-Id: I794a94fe310b8568403d4e3523c61d53468a6f02 Reported-by: Burt Silverman <burtms@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Diffstat (limited to 'src/vlib/linux')
-rw-r--r--src/vlib/linux/vmbus.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/vlib/linux/vmbus.c b/src/vlib/linux/vmbus.c
index 2af62241d4d..c1d8eb9b715 100644
--- a/src/vlib/linux/vmbus.c
+++ b/src/vlib/linux/vmbus.c
@@ -157,7 +157,7 @@ vlib_vmbus_raise_lower (int fd, const char *upper_name)
u8 *dev_net_dir;
DIR *dir;
- memset (&ifr, 0, sizeof (ifr));
+ clib_memset (&ifr, 0, sizeof (ifr));
dev_net_dir = format (0, "%s/%s%c", sysfs_class_net_path, upper_name, 0);
@@ -175,7 +175,7 @@ vlib_vmbus_raise_lower (int fd, const char *upper_name)
if (strncmp (e->d_name, "lower_", 6))
continue;
- strncpy (ifr.ifr_name, e->d_name + 6, IFNAMSIZ);
+ strncpy (ifr.ifr_name, e->d_name + 6, IFNAMSIZ - 1);
break;
}
closedir (dir);
@@ -249,8 +249,8 @@ vlib_vmbus_bind_to_uio (vlib_vmbus_addr_t * addr)
}
- memset (&ifr, 0, sizeof (ifr));
- strncpy (ifr.ifr_name, ifname, IFNAMSIZ);
+ clib_memset (&ifr, 0, sizeof (ifr));
+ strncpy (ifr.ifr_name, ifname, IFNAMSIZ - 1);
/* read up/down flags */
fd = socket (PF_INET, SOCK_DGRAM, 0);