| @@ -429,7 +429,7 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor, · 428 unmodified lines |
| 429 | * here, and we don't know what device it is | 429 | * here, and we don't know what device it is |
| 430 | * trying to work with, leave it as-is. | 430 | * trying to work with, leave it as-is. |
| 431 | */ | 431 | */ |
| 432 | vmax = 8; /* max length of vendor */ | 432 | vmax = sizeof(devinfo->vendor); |
| 433 | vskip = vendor; | 433 | vskip = vendor; |
| 434 | while (vmax > 0 && *vskip == ' ') { | 434 | while (vmax > 0 && *vskip == ' ') { |
| 435 | vmax--; | 435 | vmax--; |
| @@ -439,7 +439,7 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor, · 3 unmodified lines |
| 439 | while (vmax > 0 && vskip[vmax - 1] == ' ') | 439 | while (vmax > 0 && vskip[vmax - 1] == ' ') |
| 440 | --vmax; | 440 | --vmax; |
| 441 | | 441 | |
| 442 | mmax = 16; /* max length of model */ | 442 | mmax = sizeof(devinfo->model); |
| 443 | mskip = model; | 443 | mskip = model; |
| 444 | while (mmax > 0 && *mskip == ' ') { | 444 | while (mmax > 0 && *mskip == ' ') { |
| 445 | mmax--; | 445 | mmax--; |
| @@ -455,10 +455,12 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor, · 9 unmodified lines |
| 455 | * Behave like the older version of get_device_flags. | 455 | * Behave like the older version of get_device_flags. |
| 456 | */ | 456 | */ |
| 457 | if (memcmp(devinfo->vendor, vskip, vmax) || | 457 | if (memcmp(devinfo->vendor, vskip, vmax) || |
| 458 | devinfo->vendor[vmax]) | 458 | (vmax < sizeof(devinfo->vendor) && |
| | 459 | devinfo->vendor[vmax])) |
| 459 | continue; | 460 | continue; |
| 460 | if (memcmp(devinfo->model, mskip, mmax) || | 461 | if (memcmp(devinfo->model, mskip, mmax) || |
| 461 | devinfo->model[mmax]) | 462 | (mmax < sizeof(devinfo->model) && |
| | 463 | devinfo->model[mmax])) |
| 462 | continue; | 464 | continue; |
| 463 | return devinfo; | 465 | return devinfo; |
| 464 | } else { | 466 | } else { |