0,\r
NULL,\r
ResourcePtr,\r
- 2, // The length is 1 byte at offset 1\r
+ AcpiTableLength - Offset,\r
PARSER_PARAMS (SratResourceAllocationParser)\r
);\r
\r
+ // Make sure the SRAT structure lies inside the table\r
+ if ((Offset + *SratRALength) > AcpiTableLength) {\r
+ IncrementErrorCount ();\r
+ Print (\r
+ L"ERROR: Invalid SRAT structure length. SratRALength = %d. " \\r
+ L"RemainingTableBufferLength = %d. SRAT parsing aborted.\n",\r
+ *SratRALength,\r
+ AcpiTableLength - Offset\r
+ );\r
+ return;\r
+ }\r
+\r
switch (*SratRAType) {\r
case EFI_ACPI_6_2_GICC_AFFINITY:\r
AsciiSPrint (\r