patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] examples/vhost_scsi: fix buffer not terminated
@ 2017-09-22 13:07 Michal Jastrzebski
  2017-10-02 13:50 ` [dpdk-stable] [dpdk-dev] " Jastrzebski, MichalX K
  2017-10-12  6:44 ` [dpdk-stable] [PATCH v2] " Jacek Piasecki
  0 siblings, 2 replies; 11+ messages in thread
From: Michal Jastrzebski @ 2017-09-22 13:07 UTC (permalink / raw)
  To: yliu, maxime.coquelin
  Cc: dev, deepak.k.jain, Jacek Piasecki, changpeng.liu, stable

From: Jacek Piasecki <jacekx.piasecki@intel.com>

Fix size of buffer in strcpy. There was possible to get
not terminated string after copy operation.

Coverity issue: 158631
Fixes: db75c7af19bb ("examples/vhost_scsi: introduce a new sample app")
Cc: changpeng.liu@intel.com
Cc: stable@dpdk.org

Signed-off-by: Jacek Piasecki <jacekx.piasecki@intel.com>
---
 examples/vhost_scsi/scsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/examples/vhost_scsi/scsi.c b/examples/vhost_scsi/scsi.c
index 54d3104..de9639a 100644
--- a/examples/vhost_scsi/scsi.c
+++ b/examples/vhost_scsi/scsi.c
@@ -307,7 +307,8 @@
 		strncpy((char *)inqdata->t10_vendor_id, "INTEL", 8);
 
 		/* PRODUCT IDENTIFICATION */
-		strncpy((char *)inqdata->product_id, bdev->product_name, 16);
+		strncpy((char *)inqdata->product_id, bdev->product_name,
+				ARRAY_SIZE(inqdata->product_id) - 1);
 
 		/* PRODUCT REVISION LEVEL */
 		strncpy((char *)inqdata->product_rev, "0001", 4);
-- 
1.9.1

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-10-25 10:19 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-22 13:07 [dpdk-stable] [PATCH] examples/vhost_scsi: fix buffer not terminated Michal Jastrzebski
2017-10-02 13:50 ` [dpdk-stable] [dpdk-dev] " Jastrzebski, MichalX K
2017-10-02 15:07   ` Maxime Coquelin
2017-10-12  6:44 ` [dpdk-stable] [PATCH v2] " Jacek Piasecki
2017-10-12 11:09   ` Maxime Coquelin
2017-10-12 11:34   ` [dpdk-stable] [PATCH v3] " Jacek Piasecki
2017-10-13  7:12     ` Maxime Coquelin
2017-10-17 13:26       ` [dpdk-stable] [dpdk-dev] " Yuanhan Liu
2017-10-24 16:22         ` Thomas Monjalon
2017-10-25 10:07     ` [dpdk-stable] [PATCH v4] " Jacek Piasecki
2017-10-25 10:18       ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon

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).