From: Stephen Hemminger Date: Mon, 6 Aug 2018 18:11:07 +0000 (-0700) Subject: bus/vmbus: make sure path is null terminated X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=5ef90536d748105fcf12fa887347365bdd18e01a;p=dpdk.git 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 --- 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;