Fix minor buffer overflow reported by Coverity.
CID: 1006781
This commit is contained in:
parent
996a2e8d68
commit
aa30f2d2de
@ -10584,24 +10584,28 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio)
|
||||
*/
|
||||
if (lun == NULL || (val = ctl_get_opt(&lun->be_lun->options,
|
||||
"vendor")) == NULL) {
|
||||
strcpy(inq_ptr->vendor, CTL_VENDOR);
|
||||
strncpy(inq_ptr->vendor, CTL_VENDOR, sizeof(inq_ptr->vendor));
|
||||
} else {
|
||||
memset(inq_ptr->vendor, ' ', sizeof(inq_ptr->vendor));
|
||||
strncpy(inq_ptr->vendor, val,
|
||||
min(sizeof(inq_ptr->vendor), strlen(val)));
|
||||
}
|
||||
if (lun == NULL) {
|
||||
strcpy(inq_ptr->product, CTL_DIRECT_PRODUCT);
|
||||
strncpy(inq_ptr->product, CTL_DIRECT_PRODUCT,
|
||||
sizeof(inq_ptr->product));
|
||||
} else if ((val = ctl_get_opt(&lun->be_lun->options, "product")) == NULL) {
|
||||
switch (lun->be_lun->lun_type) {
|
||||
case T_DIRECT:
|
||||
strcpy(inq_ptr->product, CTL_DIRECT_PRODUCT);
|
||||
strncpy(inq_ptr->product, CTL_DIRECT_PRODUCT,
|
||||
sizeof(inq_ptr->product));
|
||||
break;
|
||||
case T_PROCESSOR:
|
||||
strcpy(inq_ptr->product, CTL_PROCESSOR_PRODUCT);
|
||||
strncpy(inq_ptr->product, CTL_PROCESSOR_PRODUCT,
|
||||
sizeof(inq_ptr->product));
|
||||
break;
|
||||
default:
|
||||
strcpy(inq_ptr->product, CTL_UNKNOWN_PRODUCT);
|
||||
strncpy(inq_ptr->product, CTL_UNKNOWN_PRODUCT,
|
||||
sizeof(inq_ptr->product));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user