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

Fixes: 2e16597c4bda ("net/vhost: move to vhost library statistics API")
Cc: [email protected]

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

diff --git a/drivers/net/vhost/rte_eth_vhost.c 
b/drivers/net/vhost/rte_eth_vhost.c
index 05940f2461..82e9fc929a 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -209,7 +209,7 @@ vhost_dev_xstats_get_names(struct rte_eth_dev *dev,
        }
 
        for (i = 0; i < count; i++)
-               strncpy(xstats_names[i].name, name[i].name, 
RTE_ETH_XSTATS_NAME_SIZE);
+               strlcpy(xstats_names[i].name, name[i].name, 
RTE_ETH_XSTATS_NAME_SIZE);
 
        free(name);
 
-- 
2.53.0

Reply via email to