Replace strncpy() with safer strlcpy() which always null-terminates.
Fixes: aec086c9f1c8 ("common/mlx5: share kernel interface name getter")
Cc: [email protected]
Signed-off-by: Bruce Richardson <[email protected]>
---
drivers/common/mlx5/linux/mlx5_common_os.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/common/mlx5/linux/mlx5_common_os.c
b/drivers/common/mlx5/linux/mlx5_common_os.c
index e3db6c4124..53bcc9b844 100644
--- a/drivers/common/mlx5/linux/mlx5_common_os.c
+++ b/drivers/common/mlx5/linux/mlx5_common_os.c
@@ -231,7 +231,7 @@ mlx5_get_ifname_sysfs(const char *ibdev_path, char *ifname)
rte_errno = ENOENT;
return -rte_errno;
}
- strncpy(ifname, match, IF_NAMESIZE);
+ strlcpy(ifname, match, IF_NAMESIZE);
return 0;
}
--
2.53.0