]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: acpiview: RSDP: Validate global pointer before use
authorKrzysztof Koch <krzysztof.koch@arm.com>
Mon, 20 Jan 2020 11:13:42 +0000 (19:13 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 11 Feb 2020 02:12:45 +0000 (02:12 +0000)
Check if XsdtAddress pointer has been successfully updated before it
is used for further table parsing.

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c

index 5a5c4b50c12e6eb0aa0efb1765df7e123f614da3..f4a8732a7db7c437031f2a3d2f266b80eff17b4b 100644 (file)
@@ -138,6 +138,18 @@ ParseAcpiRsdp (
     PARSER_PARAMS (RsdpParser)\r
     );\r
 \r
+  // Check if the values used to control the parsing logic have been\r
+  // successfully read.\r
+  if (XsdtAddress == NULL) {\r
+    IncrementErrorCount ();\r
+    Print (\r
+      L"ERROR: Insufficient table length. AcpiTableLength = %d." \\r
+        L"RSDP parsing aborted.\n",\r
+      AcpiTableLength\r
+      );\r
+    return;\r
+  }\r
+\r
   // This code currently supports parsing of XSDT table only\r
   // and does not parse the RSDT table. Platforms provide the\r
   // RSDT to enable compatibility with ACPI 1.0 operating systems.\r