diff options
author | Krzysztof Koch <krzysztof.koch@arm.com> | 2020-01-20 19:13:47 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2020-02-11 02:12:45 +0000 |
commit | c4a53853c10bee5be821cf0df2d1514d0cff7dc9 (patch) | |
tree | d20bfdafb44c01d1655e405f82d3f4bbfb9191eb | |
parent | ce7b77a71b467daa6ff68f4f3a1330dffc620322 (diff) | |
download | edk2-c4a53853c10bee5be821cf0df2d1514d0cff7dc9.tar.gz edk2-c4a53853c10bee5be821cf0df2d1514d0cff7dc9.tar.bz2 edk2-c4a53853c10bee5be821cf0df2d1514d0cff7dc9.zip |
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>
-rw-r--r-- | ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c index 90bdafea19..438905cb24 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c @@ -260,6 +260,19 @@ ParseAcpiMadt ( 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.
if (*MadtInterruptControllerLength < 2) {
IncrementErrorCount ();
|