Add array index check to avoid potential buffer overflow.
[efi/edk2/.git] / edk2 / UefiCpuPkg / CpuDxe / CpuDxe.c
index e117b9a..457823d 100644 (file)
@@ -857,6 +857,7 @@ RefreshGcdMemoryAttributes (
   UINT32                              FirmwareVariableMtrrCount;\r
 \r
   FirmwareVariableMtrrCount = GetFirmwareVariableMtrrCount ();\r
+  ASSERT (FirmwareVariableMtrrCount <= MTRR_NUMBER_OF_VARIABLE_MTRR);\r
 \r
 //  mIsFlushingGCD = TRUE;\r
   mIsFlushingGCD = FALSE;\r