DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/af_xdp: use snprintf instead of strncpy
@ 2020-10-07  9:01 Ciara Loftus
  2020-10-07  9:40 ` Ferruh Yigit
  0 siblings, 1 reply; 10+ messages in thread
From: Ciara Loftus @ 2020-10-07  9:01 UTC (permalink / raw)
  To: dev; +Cc: Ciara Loftus

strncpy may leave the destination buffer not NULL terminated so use
snprintf instead.

Coverity issue: 362975
Fixes: 339b88c6a91f ("net/af_xdp: support multi-queue")
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index eaf2c9c873..52495cb8fb 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);
+	snprintf(ifr.ifr_name, IFNAMSIZ, "%s", if_name);
 	ret = ioctl(fd, SIOCETHTOOL, &ifr);
 	if (ret) {
 		if (errno == EOPNOTSUPP) {
-- 
2.17.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-10-09 16:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-07  9:01 [dpdk-dev] [PATCH] net/af_xdp: use snprintf instead of strncpy Ciara Loftus
2020-10-07  9:40 ` Ferruh Yigit
2020-10-07  9:51   ` Olivier Matz
2020-10-07 10:26     ` Bruce Richardson
2020-10-07 10:28       ` Bruce Richardson
2020-10-07 11:45         ` Ferruh Yigit
2020-10-09 10:36           ` Gaëtan Rivet
2020-10-09 10:49             ` Bruce Richardson
2020-10-09 10:59             ` Ferruh Yigit
2020-10-09 16:37               ` Gaëtan Rivet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).