mirror of https://github.com/acidanthera/audk.git
ShellPkg: acpiview: MADT: Validate global pointers before use
Check if the MadtInterruptControllerType and MadtInterruptControllerLength pointers have been successfully updated before they are used for further table parsing. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
This commit is contained in:
parent
ce7b77a71b
commit
c4a53853c1
|
@ -260,6 +260,19 @@ ParseAcpiMadt (
|
||||||
PARSER_PARAMS (MadtInterruptControllerHeaderParser)
|
PARSER_PARAMS (MadtInterruptControllerHeaderParser)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Check if the values used to control the parsing logic have been
|
||||||
|
// successfully read.
|
||||||
|
if ((MadtInterruptControllerType == NULL) ||
|
||||||
|
(MadtInterruptControllerLength == NULL)) {
|
||||||
|
IncrementErrorCount ();
|
||||||
|
Print (
|
||||||
|
L"ERROR: Insufficient remaining table buffer length to read the " \
|
||||||
|
L"Interrupt Controller Structure header. Length = %d.\n",
|
||||||
|
AcpiTableLength - Offset
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure forward progress is made.
|
// Make sure forward progress is made.
|
||||||
if (*MadtInterruptControllerLength < 2) {
|
if (*MadtInterruptControllerLength < 2) {
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
|
|
Loading…
Reference in New Issue