From: Samer El-Haj-Mahmoud Date: Wed, 26 Nov 2014 07:17:31 +0000 (+0000) Subject: Fix an issue in the PCD service to prevent potential out of bound array access X-Git-Tag: edk2-stable201903~10580 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=8cc87d32c65316a98a737bb887ba316b81f8bbf1;ds=sidebyside 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 Reviewed-by: Star Zeng git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16448 6f19259b-4bc3-4df7-8a09-765794883524 --- 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.
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
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;