Skip to content

Commit

Permalink
lkl: Fix -Wstringop-truncation
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Rondom committed Nov 17, 2019
1 parent f66800e commit 27aab0b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/lkl/lib/virtio_net_tap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 27aab0b

Please sign in to comment.