DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Stephen Hemminger <sthemmin@microsoft.com>
Subject: [dpdk-dev] [PATCH 2/3] vmbus: make sure path is null terminated
Date: Mon,  6 Aug 2018 11:11:07 -0700	[thread overview]
Message-ID: <20180806181108.5913-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20180806181108.5913-1-stephen@networkplumber.org>

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 <sthemmin@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

  parent reply	other threads:[~2018-08-06 18:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-06 18:11 [dpdk-dev] [PATCH 0/3] vmbus: coverity bug fixes Stephen Hemminger
2018-08-06 18:11 ` [dpdk-dev] [PATCH 1/3] vmbus: close directory in error path Stephen Hemminger
2018-08-06 18:11 ` Stephen Hemminger [this message]
2018-08-06 18:11 ` [dpdk-dev] [PATCH 3/3] vmbus: handle eof on irq read Stephen Hemminger
2018-08-07 11:26 ` [dpdk-dev] [PATCH 0/3] vmbus: coverity bug fixes Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180806181108.5913-3-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=sthemmin@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).