[PATCH 5/5] Replacing the unsafe strcpy function

Evgeny Sokolov Evgeny.Sokolov at infotecs.ru
Tue Sep 15 11:58:46 CEST 2026


From: Sokolov Evgeny <Evgeny.Sokolov at infotecs.ru>

---
 lib/ethdev/rte_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 55ea8fe808..b040f9fa84 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -718,7 +718,7 @@ rte_eth_dev_get_name_by_port(uint16_t port_id, char *name)
 	tmp = eth_dev_shared_data->data[port_id].name;
 	rte_spinlock_unlock(rte_mcfg_ethdev_get_lock());
 
-	strcpy(name, tmp);
+	strncpy(name, tmp, RTE_ETH_NAME_MAX_LEN);
 
 	rte_ethdev_trace_get_name_by_port(port_id, name);
 
-- 
2.39.5



More information about the stable mailing list