aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/virtio/virtio_user/vhost_kernel_tap.c')
-rw-r--r--drivers/net/virtio/virtio_user/vhost_kernel_tap.c4
1 files 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 f585de8c..689a5cff 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;