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

Fixes: 61cbdd419478 ("net/mlx4: separate device control functions")
Cc: [email protected]

Signed-off-by: Bruce Richardson <[email protected]>
---
 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

Reply via email to