From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [dpdk-stable] [PATCH v3] examples/vhost_scsi: fix buffer not terminated Date: Tue, 24 Oct 2017 18:22:43 +0200 Message-ID: <3010275.oDysHLUK20@xps> References: <1507790695-10449-1-git-send-email-jacekx.piasecki@intel.com> <218441fc-8064-b05f-4eeb-4121dcdf849f@redhat.com> <20171017132637.GY1545@yliu-home> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: stable@dpdk.org, dev@dpdk.org, michalx.k.jastrzebski@intel.com, changpeng.liu@intel.com To: Yuanhan Liu , Maxime Coquelin , Jacek Piasecki Return-path: In-Reply-To: <20171017132637.GY1545@yliu-home> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 17/10/2017 15:26, Yuanhan Liu: > On Fri, Oct 13, 2017 at 09:12:33AM +0200, Maxime Coquelin wrote: > > On 10/12/2017 01:34 PM, Jacek Piasecki wrote: > > >--- 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, > > >+ ARRAY_SIZE(inqdata->product_id), "%s", > > >+ bdev->product_name); > > > /* PRODUCT REVISION LEVEL */ > > > strncpy((char *)inqdata->product_rev, "0001", 4); > > > > Acked-by: Maxime Coquelin > > Firstly, sorry for being so late response. And, > > Applied to dpdk-next-virtio. Thanks! I don't know where this ARRAY_SIZE comes from. It does not compile. In DPDK you can use RTE_DIM. This patch is removed from the next-virtio pull queue.