diff --git a/tools/lkl/lib/virtio_net_tap.c b/tools/lkl/lib/virtio_net_tap.c index e5302a375aeef8..b8ad42b5890a3a 100644 --- a/tools/lkl/lib/virtio_net_tap.c +++ b/tools/lkl/lib/virtio_net_tap.c @@ -104,7 +104,7 @@ struct lkl_netdev *lkl_netdev_tap_create(const char *ifname, int offload) #endif }; - strncpy(ifr.ifr_name, ifname, IFNAMSIZ); + snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s", ifname); return lkl_netdev_tap_init(path, offload, &ifr); }