[PATCH 17/17] net/virtio: replace strncpy with strlcpy
Bruce Richardson
bruce.richardson at intel.com
Tue Jun 23 18:51:47 CEST 2026
Replace strncpy() with safer strlcpy() which always null-terminates.
Fixes: b72099be7f27 ("net/virtio-user: fix init when using existing tap")
Cc: stable at dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
drivers/net/virtio/virtio_user/vhost_kernel_tap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
index 2431d00c33..da55aba505 100644
--- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
+++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
@@ -60,7 +60,7 @@ vhost_tap_open(const char *ifname, unsigned int r_flags, bool multi_queue)
retry_mono_q:
memset(&ifr, 0, sizeof(ifr));
- strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1);
+ strlcpy(ifr.ifr_name, ifname, IFNAMSIZ);
ifr.ifr_flags = r_flags;
if (multi_queue)
ifr.ifr_flags |= IFF_MULTI_QUEUE;
--
2.53.0
More information about the dev
mailing list