Replace strncpy() with safer strlcpy() which always null-terminates.
Fixes: b72099be7f27 ("net/virtio-user: fix init when using existing tap")
Cc: [email protected]
Signed-off-by: Bruce Richardson <[email protected]>
---
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