summaryrefslogtreecommitdiffstats
path: root/ShellPkg/Library
diff options
context:
space:
mode:
authorKrzysztof Koch <krzysztof.koch@arm.com>2020-01-20 19:13:42 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-02-11 02:12:45 +0000
commitf69248d09351ea742667749c9bdeca35e94dd946 (patch)
tree80f4b91e19be3a4759e451957768d3fbe43eb8d2 /ShellPkg/Library
parent5bd326c5f3fa987dec6b6fc85254f3fc7d6eceaf (diff)
downloadedk2-f69248d09351ea742667749c9bdeca35e94dd946.tar.gz
edk2-f69248d09351ea742667749c9bdeca35e94dd946.tar.bz2
edk2-f69248d09351ea742667749c9bdeca35e94dd946.zip
ShellPkg: acpiview: RSDP: Validate global pointer before use
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>
Diffstat (limited to 'ShellPkg/Library')
-rw-r--r--ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
index 5a5c4b50c1..f4a8732a7d 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
@@ -138,6 +138,18 @@ ParseAcpiRsdp (
PARSER_PARAMS (RsdpParser)
);
+ // Check if the values used to control the parsing logic have been
+ // successfully read.
+ if (XsdtAddress == NULL) {
+ IncrementErrorCount ();
+ Print (
+ L"ERROR: Insufficient table length. AcpiTableLength = %d." \
+ L"RSDP parsing aborted.\n",
+ AcpiTableLength
+ );
+ return;
+ }
+
// This code currently supports parsing of XSDT table only
// and does not parse the RSDT table. Platforms provide the
// RSDT to enable compatibility with ACPI 1.0 operating systems.