mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
fix segfault when dimm spd > 128 bytes
check for at least 92 bytes of spd before proceeding
This commit is contained in:
parent
7d910260e4
commit
4879ab9d21
@ -65,6 +65,11 @@ const struct valstr spd_voltage_vals[] = {
|
||||
{ 0x00, NULL },
|
||||
};
|
||||
|
||||
/*
|
||||
* JEDEC Standard Manufacturers Identification Code
|
||||
* publication JEP106N, December 2003
|
||||
*/
|
||||
|
||||
const struct valstr jedec_id1_vals[] = {
|
||||
{ 0x01, "AMD" },
|
||||
{ 0x02, "AMI" },
|
||||
@ -713,6 +718,8 @@ void ipmi_spd_print(struct ipmi_intf * intf, unsigned char id)
|
||||
printf(" Timeout while reading FRU data. (Device not present?)\n");
|
||||
return;
|
||||
}
|
||||
if (rsp->ccode)
|
||||
break;
|
||||
|
||||
len = rsp->data[0];
|
||||
memcpy(&spd_data[offset], rsp->data + 1, len);
|
||||
@ -722,6 +729,9 @@ void ipmi_spd_print(struct ipmi_intf * intf, unsigned char id)
|
||||
if (verbose)
|
||||
printbuf(spd_data, offset, "SPD DATA");
|
||||
|
||||
if (offset < 92)
|
||||
return; /* we need first 91 bytes to do our thing */
|
||||
|
||||
size = spd_data[5] * (spd_data[31] << 2);
|
||||
printf(" Memory Size : %d MB\n", size);
|
||||
printf(" Memory Type : %s\n", val2str(spd_data[2], spd_memtype_vals));
|
||||
|
Loading…
x
Reference in New Issue
Block a user