[PATCH v2 11/17] net/mlx4: replace strncpy with strlcpy

Bruce Richardson bruce.richardson at intel.com
Wed Jun 24 12:36:50 CEST 2026


Replace strncpy() with safer strlcpy() which always null-terminates.

Fixes: 61cbdd419478 ("net/mlx4: separate device control functions")
Cc: stable at dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
 drivers/net/mlx4/mlx4_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index efc6ee4577..ff353af224 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -127,7 +127,7 @@ mlx4_get_ifname(const struct mlx4_priv *priv, char (*ifname)[IF_NAMESIZE])
 		rte_errno = ENODEV;
 		return -rte_errno;
 	}
-	strncpy(*ifname, match, sizeof(*ifname));
+	strlcpy(*ifname, match, sizeof(*ifname));
 	return 0;
 }
 
-- 
2.53.0



More information about the dev mailing list