diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-11-28 03:36:25 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-11-28 03:36:25 +0000 |
commit | 648944102adb261300db8a777eafdd27b7638b45 (patch) | |
tree | bc04951234e5b06591c75c3b77a0a4519df4fbf7 /MdeModulePkg/Universal/PCD/Pei | |
parent | 957fe0935329fd9dd195401e07855a2ba432d364 (diff) | |
download | edk2-platforms-648944102adb261300db8a777eafdd27b7638b45.tar.xz |
Fix PcdSetPtr() service to use the max buffer size to check whether new buffer data is filled into.
Signed-off-by: lgao4
Reviewed-by: jlin16
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12789 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/PCD/Pei')
-rw-r--r-- | MdeModulePkg/Universal/PCD/Pei/Service.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/MdeModulePkg/Universal/PCD/Pei/Service.c b/MdeModulePkg/Universal/PCD/Pei/Service.c index 7ed4117a58..6b5dec3996 100644 --- a/MdeModulePkg/Universal/PCD/Pei/Service.c +++ b/MdeModulePkg/Universal/PCD/Pei/Service.c @@ -2,7 +2,7 @@ The driver internal functions are implmented here.
They build Pei PCD database, and provide access service to PCD database.
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2011, 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
which accompanies this distribution. The full text of the license may be found at
@@ -386,7 +386,11 @@ SetWorker ( LocalTokenNumber = PeiPcdDb->Init.LocalTokenNumberTable[TokenNumber];
if (PtrType) {
- if (*Size > PeiPcdGetSize (TokenNumber + 1)) {
+ //
+ // Get MaxSize first, then check new size with max buffer size.
+ //
+ GetPtrTypeSize (TokenNumber, &MaxSize, PeiPcdDb);
+ if (*Size > MaxSize) {
return EFI_INVALID_PARAMETER;
}
} else {
@@ -406,7 +410,7 @@ SetWorker ( if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == PCD_TYPE_SKU_ENABLED) {
if (PtrType) {
- MaxSize = GetPtrTypeSize (TokenNumber, &MaxSize, PeiPcdDb);
+ GetPtrTypeSize (TokenNumber, &MaxSize, PeiPcdDb);
} else {
MaxSize = *Size;
}
|