[dpdk-stable] patch 'examples/vhost_scsi: fix product id string termination' has been queued to stable release 17.08.1

Yuanhan Liu yliu at fridaylinux.org
Tue Nov 21 14:17:50 CET 2017


Hi,

FYI, your patch has been queued to stable release 17.08.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/24/17. So please
shout if anyone has objections.

Thanks.

	--yliu

---
>From ed143fcf2f36820679cb7eb54603f717816b6341 Mon Sep 17 00:00:00 2001
From: Jacek Piasecki <jacekx.piasecki at intel.com>
Date: Wed, 25 Oct 2017 12:07:18 +0200
Subject: [PATCH] examples/vhost_scsi: fix product id string termination

[ upstream commit 681459bf9cd5778ada011e6d8d681436ec5394f0 ]

Use snprintf instead strncpy to get safe null string termination.
There was possible to get not terminated string after strncpy operation.

Coverity issue: 158631
Fixes: db75c7af19bb ("examples/vhost_scsi: introduce a new sample app")

Signed-off-by: Jacek Piasecki <jacekx.piasecki at intel.com>
Acked-by: Maxime Coquelin <maxime.coquelin at redhat.com>
---
 examples/vhost_scsi/scsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/examples/vhost_scsi/scsi.c b/examples/vhost_scsi/scsi.c
index 54d3104..fd430ec 100644
--- a/examples/vhost_scsi/scsi.c
+++ b/examples/vhost_scsi/scsi.c
@@ -307,7 +307,9 @@ vhost_bdev_scsi_inquiry_command(struct vhost_block_dev *bdev,
 		strncpy((char *)inqdata->t10_vendor_id, "INTEL", 8);
 
 		/* PRODUCT IDENTIFICATION */
-		strncpy((char *)inqdata->product_id, bdev->product_name, 16);
+		snprintf((char *)inqdata->product_id,
+				RTE_DIM(inqdata->product_id), "%s",
+				bdev->product_name);
 
 		/* PRODUCT REVISION LEVEL */
 		strncpy((char *)inqdata->product_rev, "0001", 4);
-- 
2.7.4



More information about the stable mailing list