examples/vhost_scsi: fix product id string termination
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: db75c7af19
("examples/vhost_scsi: introduce a new sample app")
Cc: stable@dpdk.org
Signed-off-by: Jacek Piasecki <jacekx.piasecki@intel.com>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
This commit is contained in:
parent
1e02d735c1
commit
681459bf9c
@ -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,
|
||||
RTE_DIM(inqdata->product_id), "%s",
|
||||
bdev->product_name);
|
||||
|
||||
/* PRODUCT REVISION LEVEL */
|
||||
strncpy((char *)inqdata->product_rev, "0001", 4);
|
||||
|
Loading…
Reference in New Issue
Block a user