From: Ciara Loftus Date: Wed, 7 Oct 2020 09:20:50 +0000 (+0000) Subject: net/af_xdp: use strlcpy instead of strncpy X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=6d3c595d3a4e856307b92d1a824b07b48da1cc3c;p=dpdk.git net/af_xdp: use strlcpy instead of strncpy strncpy may leave the destination buffer not NULL terminated so use strlcpy instead. Coverity issue: 362975 Fixes: 339b88c6a91f ("net/af_xdp: support multi-queue") Cc: stable@dpdk.org Signed-off-by: Ciara Loftus Acked-by: Bruce Richardson Reviewed-by: Ferruh Yigit --- diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index eaf2c9c873..ac00cbab8e 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -1362,7 +1362,7 @@ xdp_get_channels_info(const char *if_name, int *max_queues, channels.cmd = ETHTOOL_GCHANNELS; ifr.ifr_data = (void *)&channels; - strncpy(ifr.ifr_name, if_name, IFNAMSIZ); + strlcpy(ifr.ifr_name, if_name, IFNAMSIZ); ret = ioctl(fd, SIOCETHTOOL, &ifr); if (ret) { if (errno == EOPNOTSUPP) {