From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com [66.111.4.224]) by dpdk.org (Postfix) with ESMTP id C5A611B802; Tue, 17 Oct 2017 15:26:44 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 2F0A41343; Tue, 17 Oct 2017 09:26:44 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Tue, 17 Oct 2017 09:26:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=rxR3YaBv928jSAg4O45gLkYAd3C7rLNtMMSl5fJEVD0=; b=LtBBGgAA 6QGCTIIZv64R/QvCXPWnnjAZ/WQggYUElCENq2T9r0ArJdMsJZRrYAHGutN7Tqe7 Z8qjgMNg9N0ZMupfSNwPxVR/p5MpuBQ1bjX9JJFHG3qfO9b9fyMpypbU2L16Z5iU fbPUIIT0GFzxQFKG9CoRfZy+aAb2vDgSC7B5I3bDKlNc//DTUkxbiSxTeLjIkYde Z75+lLkqCf+9j0p0qhBx7X7lrtEgNaqR2lZf/9H8YjMC37HQ3mW37qM4m0HQByGn UfA/46VT4QPtrTiCUMXLLkLrbtwiXSGYVU0NHQloUiHQZJYuins+5veMr+b6RqnA aqKUP4VsSXsmVg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=rxR3YaBv928jSAg4O45gLkYAd3C7r LNtMMSl5fJEVD0=; b=HSzQW5P6aPCwATPxT+Gp2l/JxBJzqOxAo0cwueHz3zHaz HgJsNKzhupNdJsTd/s8xymjuKg3jn1RXYQUXySiQ6Cv52kVNMw6xeM2Xv3geSSx+ 7efMHhRQPGVW45UGgK1jL7Be+BQ8jv4ePQeEq/U1nlGZR5IHpchAxka1eugtx+tm MrIqDYT0PRjVVZ61LIym8BFgWAF/pmWlaVAd8rAX0RxxPUtuvMbY0HWiHr3xGl3Q DMxxwC5DUTgayzx/xZdWQHrnX1TQIfhW4ql6lFvo0J0z1C2YsfBnkpbvbFgHieo5 wGaT3b+duwdHH+ZkUOqFJoGTNND1aG38aQq2MrzXw== X-ME-Sender: Received: from yliu-home (unknown [124.79.168.36]) by mail.messagingengine.com (Postfix) with ESMTPA id 8A0247F91F; Tue, 17 Oct 2017 09:26:42 -0400 (EDT) Date: Tue, 17 Oct 2017 21:26:37 +0800 From: Yuanhan Liu To: Maxime Coquelin Cc: Jacek Piasecki , dev@dpdk.org, michalx.k.jastrzebski@intel.com, changpeng.liu@intel.com, stable@dpdk.org Message-ID: <20171017132637.GY1545@yliu-home> References: <1507790695-10449-1-git-send-email-jacekx.piasecki@intel.com> <1507808061-37679-1-git-send-email-jacekx.piasecki@intel.com> <218441fc-8064-b05f-4eeb-4121dcdf849f@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <218441fc-8064-b05f-4eeb-4121dcdf849f@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v3] examples/vhost_scsi: fix buffer not terminated X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Oct 2017 13:26:45 -0000 On Fri, Oct 13, 2017 at 09:12:33AM +0200, Maxime Coquelin wrote: > > > On 10/12/2017 01:34 PM, Jacek Piasecki wrote: > >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") > >Cc: changpeng.liu@intel.com > >Cc: stable@dpdk.org > > > >Signed-off-by: Jacek Piasecki > >--- > > 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..2de3110 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, > >+ 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! --yliu