summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShenglei Zhang <shenglei.zhang@intel.com>2019-10-15 14:45:44 +0800
committerLiming Gao <liming.gao@intel.com>2019-11-04 08:54:24 +0800
commit121955fd4f9a2a5da7e0e8fe0c47ad5570f18d32 (patch)
tree530082c838dffcd044bc1484fd72a47367f6140f
parent2b23beb043a10dd3c00f43c1f7bb72f47554ff3a (diff)
downloadedk2-121955fd4f9a2a5da7e0e8fe0c47ad5570f18d32.zip
edk2-121955fd4f9a2a5da7e0e8fe0c47ad5570f18d32.tar.gz
edk2-121955fd4f9a2a5da7e0e8fe0c47ad5570f18d32.tar.bz2
MdeModulePkg/Variable/Pei: Update the condition in if statement
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>
-rw-r--r--MdeModulePkg/Universal/Variable/Pei/Variable.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/MdeModulePkg/Universal/Variable/Pei/Variable.c b/MdeModulePkg/Universal/Variable/Pei/Variable.c
index 715802f..f61465f 100644
--- a/MdeModulePkg/Universal/Variable/Pei/Variable.c
+++ b/MdeModulePkg/Universal/Variable/Pei/Variable.c
@@ -896,7 +896,7 @@ FindVariableEx (
//
if ((IndexTable != NULL) && !StopRecord) {
Offset = (UINTN) Variable - (UINTN) LastVariable;
- if ((Offset > 0x0FFFF) || (IndexTable->Length == sizeof (IndexTable->Index) / sizeof (IndexTable->Index[0]))) {
+ if ((Offset > 0x0FFFF) || (IndexTable->Length >= sizeof (IndexTable->Index) / sizeof (IndexTable->Index[0]))) {
//
// Stop to record if the distance of two neighbouring VAR_ADDED variable is larger than the allowable scope(UINT16),
// or the record buffer is full.