mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
smbios: Harden decoding of the BCD revision
bcd2bin() must not be called with a value greater or equal to LIBKERN_LEN_BCD2BIN. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation (cherry picked from commit 516e24e57987d184cce70e7f31443653aa1a5e63)
This commit is contained in:
parent
5d9f1bf830
commit
55e8cdff14
1 changed files with 7 additions and 5 deletions
|
|
@ -242,18 +242,20 @@ smbios_attach (device_t dev)
|
|||
"Docrev: %u, Entry Point Revision: %u\n",
|
||||
sc->eps3->docrev, sc->eps3->entry_point_revision);
|
||||
} else {
|
||||
const struct smbios_eps *const eps = va;
|
||||
const uint8_t bcd = eps->BCD_revision;
|
||||
|
||||
sc->eps = va;
|
||||
device_printf(dev, "Entry point: v2.1 (32-bit), Version: %u.%u",
|
||||
sc->eps->major_version, sc->eps->minor_version);
|
||||
if (bcd2bin(sc->eps->BCD_revision))
|
||||
eps->major_version, eps->minor_version);
|
||||
if (bcd < LIBKERN_LEN_BCD2BIN && bcd2bin(bcd) != 0)
|
||||
printf(", BCD Revision: %u.%u\n",
|
||||
bcd2bin(sc->eps->BCD_revision >> 4),
|
||||
bcd2bin(sc->eps->BCD_revision & 0x0f));
|
||||
bcd2bin(bcd >> 4), bcd2bin(bcd & 0x0f));
|
||||
else
|
||||
printf("\n");
|
||||
if (bootverbose)
|
||||
device_printf(dev, "Entry Point Revision: %u\n",
|
||||
sc->eps->entry_point_revision);
|
||||
eps->entry_point_revision);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue