]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/Variable/Pei: Update the condition in if statement
authorShenglei Zhang <shenglei.zhang@intel.com>
Tue, 15 Oct 2019 06:45:44 +0000 (14:45 +0800)
committerLiming Gao <liming.gao@intel.com>
Mon, 4 Nov 2019 00:54:24 +0000 (08:54 +0800)
IndexTable->Length is used as index in array IndexTable->Index[].
So IndexTable->Length needs to be checked, which should be less than
the array size.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
MdeModulePkg/Universal/Variable/Pei/Variable.c

index 715802f33c2963b5cbcef9c544e4310aa6467e9e..f61465fc30456e9ddd321eeae39cec46416dd67a 100644 (file)
@@ -896,7 +896,7 @@ FindVariableEx (
       //\r
       if ((IndexTable != NULL) && !StopRecord) {\r
         Offset = (UINTN) Variable - (UINTN) LastVariable;\r
-        if ((Offset > 0x0FFFF) || (IndexTable->Length == sizeof (IndexTable->Index) / sizeof (IndexTable->Index[0]))) {\r
+        if ((Offset > 0x0FFFF) || (IndexTable->Length >= sizeof (IndexTable->Index) / sizeof (IndexTable->Index[0]))) {\r
           //\r
           // Stop to record if the distance of two neighbouring VAR_ADDED variable is larger than the allowable scope(UINT16),\r
           // or the record buffer is full.\r