]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fix an issue in the PCD service to prevent potential out of bound array access
authorSamer El-Haj-Mahmoud <elhaj@hp.com>
Wed, 26 Nov 2014 07:17:31 +0000 (07:17 +0000)
committerlzeng14 <lzeng14@Edk2>
Wed, 26 Nov 2014 07:17:31 +0000 (07:17 +0000)
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

MdeModulePkg/Universal/PCD/Dxe/Service.c

index 4cbf6dd209ec6e72662e46311f96a019fcf8d63e..13f4d9c5e962704722f3ef69ac33711e606dab40 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
     Help functions used by PCD DXE driver.\r
 \r
+Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>\r
 Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
@@ -1508,7 +1509,7 @@ GetExPcdTokenNumber (
 \r
       MatchGuidIdx = MatchGuid - GuidTable;\r
 \r
-      for (Index = 0; Index < mPeiExMapppingTableSize; Index++) {\r
+      for (Index = 0; Index < mPcdDatabase.PeiDb->ExTokenCount; Index++) {\r
         if ((ExTokenNumber == ExMap[Index].ExTokenNumber) &&\r
             (MatchGuidIdx == ExMap[Index].ExGuidIndex)) {\r
             return ExMap[Index].TokenNumber;\r
@@ -1529,7 +1530,7 @@ GetExPcdTokenNumber (
 \r
   MatchGuidIdx = MatchGuid - GuidTable;\r
 \r
-  for (Index = 0; Index < mDxeExMapppingTableSize; Index++) {\r
+  for (Index = 0; Index < mPcdDatabase.DxeDb->ExTokenCount; Index++) {\r
     if ((ExTokenNumber == ExMap[Index].ExTokenNumber) &&\r
          (MatchGuidIdx == ExMap[Index].ExGuidIndex)) {\r
         return ExMap[Index].TokenNumber;\r