ID:358 - check data length in else branch of ipmi_spd_print()

Commit adds data length check into '} else {' branch of ipmi_spd_print() in
order to avoid out-of-bound access.
This commit is contained in:
Zdenek Styblik 2015-01-04 14:58:37 +01:00
parent 9811f79eae
commit d9acbc4cd0

View File

@ -950,6 +950,9 @@ ipmi_spd_print(uint8_t *spd_data, int len)
} }
else else
{ {
if (len < 100) {
return (-1);
}
ii = (spd_data[3] & 0x0f) + (spd_data[4] & 0x0f) - 17; ii = (spd_data[3] & 0x0f) + (spd_data[4] & 0x0f) - 17;
k = ((spd_data[5] & 0x7) + 1) * spd_data[17]; k = ((spd_data[5] & 0x7) + 1) * spd_data[17];