summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal/PCD
diff options
context:
space:
mode:
authorSamer El-Haj-Mahmoud <elhaj@hp.com>2014-11-26 07:17:31 +0000
committerlzeng14 <lzeng14@Edk2>2014-11-26 07:17:31 +0000
commit8cc87d32c65316a98a737bb887ba316b81f8bbf1 (patch)
tree10145c54514733fd48b48e4ba0e8179f28845cdb /MdeModulePkg/Universal/PCD
parent42645c3dcf0488c616422dcdfd1596939223f432 (diff)
downloadedk2-8cc87d32c65316a98a737bb887ba316b81f8bbf1.tar.gz
edk2-8cc87d32c65316a98a737bb887ba316b81f8bbf1.tar.bz2
edk2-8cc87d32c65316a98a737bb887ba316b81f8bbf1.zip
Fix an issue in the PCD service to prevent potential out of bound array access
that can cause an exception. mPeiExMapppingTableSize is the table size, but the code needs to check the entry number. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Samer El-Haj-Mahmoud <elhaj@hp.com> Reviewed-by: Star Zeng <star.zeng@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16448 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/PCD')
-rw-r--r--MdeModulePkg/Universal/PCD/Dxe/Service.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/MdeModulePkg/Universal/PCD/Dxe/Service.c b/MdeModulePkg/Universal/PCD/Dxe/Service.c
index 4cbf6dd209..13f4d9c5e9 100644
--- a/MdeModulePkg/Universal/PCD/Dxe/Service.c
+++ b/MdeModulePkg/Universal/PCD/Dxe/Service.c
@@ -1,6 +1,7 @@
/** @file
Help functions used by PCD DXE driver.
+Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -1508,7 +1509,7 @@ GetExPcdTokenNumber (
MatchGuidIdx = MatchGuid - GuidTable;
- for (Index = 0; Index < mPeiExMapppingTableSize; Index++) {
+ for (Index = 0; Index < mPcdDatabase.PeiDb->ExTokenCount; Index++) {
if ((ExTokenNumber == ExMap[Index].ExTokenNumber) &&
(MatchGuidIdx == ExMap[Index].ExGuidIndex)) {
return ExMap[Index].TokenNumber;
@@ -1529,7 +1530,7 @@ GetExPcdTokenNumber (
MatchGuidIdx = MatchGuid - GuidTable;
- for (Index = 0; Index < mDxeExMapppingTableSize; Index++) {
+ for (Index = 0; Index < mPcdDatabase.DxeDb->ExTokenCount; Index++) {
if ((ExTokenNumber == ExMap[Index].ExTokenNumber) &&
(MatchGuidIdx == ExMap[Index].ExGuidIndex)) {
return ExMap[Index].TokenNumber;