patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Yuanhan Liu <yliu@fridaylinux.org>
To: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: Jacek Piasecki <jacekx.piasecki@intel.com>,
	dev@dpdk.org, michalx.k.jastrzebski@intel.com,
	changpeng.liu@intel.com, stable@dpdk.org
Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v3] examples/vhost_scsi: fix buffer not terminated
Date: Tue, 17 Oct 2017 21:26:37 +0800	[thread overview]
Message-ID: <20171017132637.GY1545@yliu-home> (raw)
In-Reply-To: <218441fc-8064-b05f-4eeb-4121dcdf849f@redhat.com>

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 <jacekx.piasecki@intel.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..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 <maxime.coquelin@redhat.com>

Firstly, sorry for being so late response. And,

Applied to dpdk-next-virtio. Thanks!

	--yliu

  reply	other threads:[~2017-10-17 13:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-22 13:07 [dpdk-stable] [PATCH] " 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       ` Yuanhan Liu [this message]
2017-10-24 16:22         ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
2017-10-25 10:07     ` [dpdk-stable] [PATCH v4] " Jacek Piasecki
2017-10-25 10:18       ` [dpdk-stable] [dpdk-dev] " 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=20171017132637.GY1545@yliu-home \
    --to=yliu@fridaylinux.org \
    --cc=changpeng.liu@intel.com \
    --cc=dev@dpdk.org \
    --cc=jacekx.piasecki@intel.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=michalx.k.jastrzebski@intel.com \
    --cc=stable@dpdk.org \
    /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).