[dpdk-stable] patch 'net/virtio-user: fix TAP name string termination' has been queued to stable release 17.08.1

Yuanhan Liu yliu at fridaylinux.org
Tue Nov 21 14:17:12 CET 2017


Hi,

FYI, your patch has been queued to stable release 17.08.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/24/17. So please
shout if anyone has objections.

Thanks.

	--yliu

---
>From ca7e6e85c42cc82e711bf8e2a324e17675d0b9d0 Mon Sep 17 00:00:00 2001
From: Sebastian Basierski <sebastianx.basierski at intel.com>
Date: Tue, 19 Sep 2017 13:41:04 +0200
Subject: [PATCH] net/virtio-user: fix TAP name string termination

[ upstream commit 907d125e2c3a4801558c2f6988e54f427e1b444a ]

Fix calling strncpy with the a maximum size equal of destination
array size.

Coverity issue: 140732
Fixes: e3b434818bbb ("net/virtio-user: support kernel vhost")

Signed-off-by: Sebastian Basierski <sebastianx.basierski at intel.com>
Acked-by: Jianfeng Tan <jianfeng.tan at intel.com>
Acked-by: Yuanhan Liu <yliu at fridaylinux.org>
---
 drivers/net/virtio/virtio_user/vhost_kernel_tap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
index f585de8..689a5cf 100644
--- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
+++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
@@ -95,9 +95,9 @@ vhost_kernel_open_tap(char **p_ifname, int hdr_size, int req_mq)
 		ifr.ifr_flags |= IFF_MULTI_QUEUE;
 
 	if (*p_ifname)
-		strncpy(ifr.ifr_name, *p_ifname, IFNAMSIZ);
+		strncpy(ifr.ifr_name, *p_ifname, IFNAMSIZ - 1);
 	else
-		strncpy(ifr.ifr_name, "tap%d", IFNAMSIZ);
+		strncpy(ifr.ifr_name, "tap%d", IFNAMSIZ - 1);
 	if (ioctl(tapfd, TUNSETIFF, (void *)&ifr) == -1) {
 		PMD_DRV_LOG(ERR, "TUNSETIFF failed: %s", strerror(errno));
 		goto error;
-- 
2.7.4



More information about the stable mailing list