mirror of
https://github.com/tianocore/edk2
synced 2026-08-27 00:23:19 -04:00
MdeModulePkg/SmbiosDxe: fix table length check
In case EntryPointStructure does not exist yet use a length of zero instead of skipping the check altogether. Fixes a heap overflow in the following code flow in case the first smbios table installed is larger than SMBIOS_TABLE_MAX_LENGTH. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
bc71cc972d
commit
3f97b8bc7f
1 changed files with 2 additions and 2 deletions
|
|
@ -424,8 +424,8 @@ SmbiosAdd (
|
|||
// in the Structure Table Length field of the SMBIOS Structure Table Entry Point,
|
||||
// which is a WORD field limited to 65,535 bytes. So the max size of 32-bit table should not exceed 65,535 bytes.
|
||||
//
|
||||
if ((EntryPointStructure != NULL) &&
|
||||
(EntryPointStructure->TableLength + StructureSize > SMBIOS_TABLE_MAX_LENGTH))
|
||||
if (((EntryPointStructure != NULL) ? EntryPointStructure->TableLength : 0) +
|
||||
StructureSize > SMBIOS_TABLE_MAX_LENGTH)
|
||||
{
|
||||
DEBUG ((DEBUG_INFO, "SmbiosAdd: Total length exceeds max 32-bit table length with type = %d size = 0x%x\n", Record->Type, StructureSize));
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue