[PATCH v2 16/17] net/vhost: replace strncpy with strlcpy
Bruce Richardson
bruce.richardson at intel.com
Wed Jun 24 12:36:55 CEST 2026
Replace strncpy() with safer strlcpy() which always null-terminates.
Fixes: 2e16597c4bda ("net/vhost: move to vhost library statistics API")
Cc: stable at dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
drivers/net/vhost/rte_eth_vhost.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 05940f2461..82e9fc929a 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -209,7 +209,7 @@ vhost_dev_xstats_get_names(struct rte_eth_dev *dev,
}
for (i = 0; i < count; i++)
- strncpy(xstats_names[i].name, name[i].name, RTE_ETH_XSTATS_NAME_SIZE);
+ strlcpy(xstats_names[i].name, name[i].name, RTE_ETH_XSTATS_NAME_SIZE);
free(name);
--
2.53.0
More information about the dev
mailing list