From 5ef90536d748105fcf12fa887347365bdd18e01a Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 6 Aug 2018 11:11:07 -0700 Subject: [PATCH] bus/vmbus: make sure path is null terminated 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 --- 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 0b1b153cc0..bc2c6235e6 100644 --- a/drivers/bus/vmbus/linux/vmbus_uio.c +++ b/drivers/bus/vmbus/linux/vmbus_uio.c @@ -18,6 +18,7 @@ #include #include #include +#include #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.20.1