All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Changpeng Liu <changpeng.liu@intel.com>
Cc: dev@dpdk.org
Subject: Re: [PATCH 2/2] examples/vhost_scsi: fix potential buffer overrun with safe copy API
Date: Tue, 22 May 2018 19:47:39 +0200	[thread overview]
Message-ID: <3339436.bIZ7ygsVkQ@xps> (raw)
In-Reply-To: <1526599932-13083-2-git-send-email-changpeng.liu@intel.com>

18/05/2018 01:32, Changpeng Liu:
> Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>

Missing explanations.

> -			strlcpy((char *)vpage->params, bdev->name,
> -					sizeof(vpage->params));
> +			vhost_strcpy_pad((char *)vpage->params, bdev->name,
> +					sizeof(vpage->params), ' ');

Why do you think vhost_strcpy_pad is safer than strlcpy?

> -	strncpy(bdev->name, bdev_name, sizeof(bdev->name));
> -	strncpy(bdev->product_name, bdev_serial, sizeof(bdev->product_name));
> +	snprintf(bdev->name, sizeof(bdev->name), "%s", bdev_name);
> +	snprintf(bdev->product_name, sizeof(bdev->product_name),
> +		"%s", bdev_serial);

You should use strlcpy.

  reply	other threads:[~2018-05-22 17:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-17 23:32 [PATCH 1/2] examples/vhost_scsi: add virtio-1.0 feature bit support Changpeng Liu
2018-05-17 23:32 ` [PATCH 2/2] examples/vhost_scsi: fix potential buffer overrun with safe copy API Changpeng Liu
2018-05-22 17:47   ` Thomas Monjalon [this message]
2018-05-22 17:58     ` Liu, Changpeng
2018-05-22 18:18       ` Thomas Monjalon
2018-05-18 12:35 ` [PATCH 1/2] examples/vhost_scsi: add virtio-1.0 feature bit support Maxime Coquelin
2018-05-22 17:51   ` Thomas Monjalon
2018-05-22 20:33     ` Thomas Monjalon
2018-05-22 20:45       ` Liu, Changpeng

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=3339436.bIZ7ygsVkQ@xps \
    --to=thomas@monjalon.net \
    --cc=changpeng.liu@intel.com \
    --cc=dev@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.