diff mbox

[NETMAP,2/2] linux-netmap: fix buffer not null terminated

Message ID 1429525035-21377-3-git-send-email-ciprian.barbu@linaro.org
State New
Headers show

Commit Message

Ciprian Barbu April 20, 2015, 10:17 a.m. UTC
CID 56895: Buffer not null terminated: odp_packet_netmap.c
https://bugs.linaro.org/show_bug.cgi?id=1394

Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org>
---
 platform/linux-netmap/odp_packet_netmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/platform/linux-netmap/odp_packet_netmap.c b/platform/linux-netmap/odp_packet_netmap.c
index 2988b96..b2a4e0a 100644
--- a/platform/linux-netmap/odp_packet_netmap.c
+++ b/platform/linux-netmap/odp_packet_netmap.c
@@ -106,7 +106,7 @@  static int nm_do_ioctl(pkt_netmap_t * const pkt_nm, unsigned long cmd,
 	int fd = pkt_nm->nm_dev->sockfd;
 
 	memset(&ifr, 0, sizeof(ifr));
-	strncpy(ifr.ifr_name, pkt_nm->nm_dev->ifname, sizeof(ifr.ifr_name));
+	snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s", pkt_nm->nm_dev->ifname);
 
 	switch (cmd) {
 	case SIOCSIFFLAGS: