mirror of https://github.com/acidanthera/audk.git
ShellPkg: acpiview: SRAT: Validate global pointers before use
Check if SratRAType and SratRALength 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
eb9db72ca8
commit
ce7b77a71b
|
@ -399,6 +399,19 @@ ParseAcpiSrat (
|
|||
PARSER_PARAMS (SratResourceAllocationParser)
|
||||
);
|
||||
|
||||
// Check if the values used to control the parsing logic have been
|
||||
// successfully read.
|
||||
if ((SratRAType == NULL) ||
|
||||
(SratRALength == NULL)) {
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Insufficient remaining table buffer length to read the " \
|
||||
L"Static Resource Allocation structure header. Length = %d.\n",
|
||||
AcpiTableLength - Offset
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure the SRAT structure lies inside the table
|
||||
if ((Offset + *SratRALength) > AcpiTableLength) {
|
||||
IncrementErrorCount ();
|
||||
|
|
Loading…
Reference in New Issue