svn commit: r272619 - stable/10/sys/cam/ctl
Alexander Motin
mav at FreeBSD.org
Mon Oct 6 12:38:36 UTC 2014
Author: mav
Date: Mon Oct 6 12:38:35 2014
New Revision: 272619
URL: https://svnweb.freebsd.org/changeset/base/272619
Log:
MFC r271352: Fix minor buffer overflow reported by Coverity.
Modified:
stable/10/sys/cam/ctl/ctl.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/cam/ctl/ctl.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl.c Mon Oct 6 12:37:35 2014 (r272618)
+++ stable/10/sys/cam/ctl/ctl.c Mon Oct 6 12:38:35 2014 (r272619)
@@ -10597,24 +10597,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 {
More information about the svn-src-stable
mailing list