[dpdk-stable] [dpdk-dev] [PATCH] examples/vhost_scsi: fix buffer not terminated

Thomas Monjalon thomas at monjalon.net
Mon May 14 21:08:08 CEST 2018


22/09/2017 15:09, Michal Jastrzebski:
> From: Jacek Piasecki <jacekx.piasecki at intel.com>
> 
> Fix size of buffer in strcpy. There was possible to get
> not terminated string after copy operation.
> 
> Coverity issue: 158629
> Fixes: db75c7af19bb ("examples/vhost_scsi: introduce a new sample app")
> Cc: changpeng.liu at intel.com
> Cc: stable at dpdk.org
> 
> Signed-off-by: Jacek Piasecki <jacekx.piasecki at intel.com>
> ---
> -	strncpy(bdev->name, bdev_name, sizeof(bdev->name));
> -	strncpy(bdev->product_name, bdev_serial, sizeof(bdev->product_name));
> +	strncpy(bdev->name, bdev_name, sizeof(bdev->name) - 1);
> +	strncpy(bdev->product_name, bdev_serial,
> +			sizeof(bdev->product_name) - 1);

Can it be fixed with strlcpy?

I wonder why recent patch from Reshma is not touching these lines:
	http://dpdk.org/commit/21ce8e44b8d




More information about the stable mailing list