From 27aab0b785707002192393c2f3574932e2c72388 Mon Sep 17 00:00:00 2001 From: Andreas Gnau Date: Sun, 17 Nov 2019 22:27:46 +0100 Subject: [PATCH] lkl: Fix -Wstringop-truncation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lib/virtio_net_tap.c: In function ‘lkl_netdev_tap_create’: lib/virtio_net_tap.c:107:2: warning: ‘strncpy’ specified bound 16 equals destination size [-Wstringop-truncation] Signed-off-by: Andreas Gnau --- tools/lkl/lib/virtio_net_tap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); }