|
@@ -429,7 +429,7 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor,
|
|
* here, and we don't know what device it is
|
|
* here, and we don't know what device it is
|
|
* trying to work with, leave it as-is.
|
|
* trying to work with, leave it as-is.
|
|
*/
|
|
*/
|
|
- vmax = 8; /* max length of vendor */
|
|
|
|
|
|
+ vmax = sizeof(devinfo->vendor);
|
|
vskip = vendor;
|
|
vskip = vendor;
|
|
while (vmax > 0 && *vskip == ' ') {
|
|
while (vmax > 0 && *vskip == ' ') {
|
|
vmax--;
|
|
vmax--;
|
|
@@ -439,7 +439,7 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor,
|
|
while (vmax > 0 && vskip[vmax - 1] == ' ')
|
|
while (vmax > 0 && vskip[vmax - 1] == ' ')
|
|
--vmax;
|
|
--vmax;
|
|
|
|
|
|
- mmax = 16; /* max length of model */
|
|
|
|
|
|
+ mmax = sizeof(devinfo->model);
|
|
mskip = model;
|
|
mskip = model;
|
|
while (mmax > 0 && *mskip == ' ') {
|
|
while (mmax > 0 && *mskip == ' ') {
|
|
mmax--;
|
|
mmax--;
|
|
@@ -455,10 +455,12 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor,
|
|
* Behave like the older version of get_device_flags.
|
|
* Behave like the older version of get_device_flags.
|
|
*/
|
|
*/
|
|
if (memcmp(devinfo->vendor, vskip, vmax) ||
|
|
if (memcmp(devinfo->vendor, vskip, vmax) ||
|
|
- devinfo->vendor[vmax])
|
|
|
|
|
|
+ (vmax < sizeof(devinfo->vendor) &&
|
|
|
|
+ devinfo->vendor[vmax]))
|
|
continue;
|
|
continue;
|
|
if (memcmp(devinfo->model, mskip, mmax) ||
|
|
if (memcmp(devinfo->model, mskip, mmax) ||
|
|
- devinfo->model[mmax])
|
|
|
|
|
|
+ (mmax < sizeof(devinfo->model) &&
|
|
|
|
+ devinfo->model[mmax]))
|
|
continue;
|
|
continue;
|
|
return devinfo;
|
|
return devinfo;
|
|
} else {
|
|
} else {
|