Use strlcpy rather than strncpy to avoid any issues about null termination.
Coverity issue 302859 Fixes: 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support") Signed-off-by: Stephen Hemminger <sthem...@microsoft.com> --- drivers/bus/vmbus/linux/vmbus_uio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c index 0b1b153cc017..bc2c6235e6bc 100644 --- a/drivers/bus/vmbus/linux/vmbus_uio.c +++ b/drivers/bus/vmbus/linux/vmbus_uio.c @@ -18,6 +18,7 @@ #include <rte_common.h> #include <rte_malloc.h> #include <rte_bus_vmbus.h> +#include <rte_string_fns.h> #include "private.h" @@ -89,7 +90,7 @@ vmbus_uio_alloc_resource(struct rte_vmbus_device *dev, goto error; } - strncpy((*uio_res)->path, devname, PATH_MAX); + strlcpy((*uio_res)->path, devname, PATH_MAX); rte_uuid_copy((*uio_res)->id, dev->device_id); return 0; -- 2.18.0