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 | |
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')
-rw-r--r-- | MdeModulePkg/Universal/PCD/Dxe/Service.c | 8 | ||||
-rw-r--r-- | MdeModulePkg/Universal/PCD/Pei/Service.c | 10 |
2 files changed, 13 insertions, 5 deletions
diff --git a/MdeModulePkg/Universal/PCD/Dxe/Service.c b/MdeModulePkg/Universal/PCD/Dxe/Service.c index 8a550d38e0..bf8e74dfb3 100644 --- a/MdeModulePkg/Universal/PCD/Dxe/Service.c +++ b/MdeModulePkg/Universal/PCD/Dxe/Service.c @@ -1,7 +1,7 @@ /** @file
Help functions used by PCD DXE driver.
-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
@@ -741,7 +741,11 @@ SetWorker ( ASSERT (TokenNumber + 1 < PCD_TOTAL_TOKEN_NUMBER + 1);
if (PtrType) {
- if (*Size > DxePcdGetSize (TokenNumber + 1)) {
+ //
+ // Get MaxSize first, then check new size with max buffer size.
+ //
+ GetPtrTypeSize (TokenNumber, &MaxSize);
+ if (*Size > MaxSize) {
return EFI_INVALID_PARAMETER;
}
} else {
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;
}
|