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

Fixes: ee0fa7552a0a ("net/dpaa: forbid MTU configuration for shared interface")
Cc: [email protected]

Signed-off-by: Bruce Richardson <[email protected]>
---
 drivers/net/dpaa/dpaa_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 9f976d179b..8b1072f9b9 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -247,7 +247,7 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
                        DPAA_PMD_ERR("Cannot open IF socket");
                        return -errno;
                }
-               strncpy(ifr.ifr_name, dpaa_intf->name, IFNAMSIZ - 1);
+               strlcpy(ifr.ifr_name, dpaa_intf->name, IFNAMSIZ);
 
                if (ioctl(socket_fd, SIOCGIFMTU, &ifr) < 0) {
                        DPAA_PMD_ERR("Cannot get interface mtu");
-- 
2.53.0

Reply via email to