Skip to content

Commit adad633

Browse files
labbottmartinkpetersen
authored andcommitted
scsi: ibmvscsis: Ensure partition name is properly NUL terminated
While reviewing another part of the code, Kees noticed that the strncpy of the partition name might not always be NUL terminated. Switch to using strscpy which does this safely. Reported-by: Kees Cook <keescook@chromium.org> Signed-off-by: Laura Abbott <labbott@redhat.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent d792d4c commit adad633

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3477,7 +3477,7 @@ static int ibmvscsis_probe(struct vio_dev *vdev,
34773477
snprintf(vscsi->eye, sizeof(vscsi->eye), "VSCSI %s", vdev->name);
34783478

34793479
vscsi->dds.unit_id = vdev->unit_address;
3480-
strncpy(vscsi->dds.partition_name, partition_name,
3480+
strscpy(vscsi->dds.partition_name, partition_name,
34813481
sizeof(vscsi->dds.partition_name));
34823482
vscsi->dds.partition_num = partition_number;
34833483

0 commit comments

Comments
 (0)