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
This commit is contained in:
parent
957fe09353
commit
648944102a
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Help functions used by PCD DXE driver.
|
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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
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);
|
ASSERT (TokenNumber + 1 < PCD_TOTAL_TOKEN_NUMBER + 1);
|
||||||
|
|
||||||
if (PtrType) {
|
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;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
The driver internal functions are implmented here.
|
The driver internal functions are implmented here.
|
||||||
They build Pei PCD database, and provide access service to PCD database.
|
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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -386,7 +386,11 @@ SetWorker (
|
||||||
LocalTokenNumber = PeiPcdDb->Init.LocalTokenNumberTable[TokenNumber];
|
LocalTokenNumber = PeiPcdDb->Init.LocalTokenNumberTable[TokenNumber];
|
||||||
|
|
||||||
if (PtrType) {
|
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;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -406,7 +410,7 @@ SetWorker (
|
||||||
|
|
||||||
if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == PCD_TYPE_SKU_ENABLED) {
|
if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == PCD_TYPE_SKU_ENABLED) {
|
||||||
if (PtrType) {
|
if (PtrType) {
|
||||||
MaxSize = GetPtrTypeSize (TokenNumber, &MaxSize, PeiPcdDb);
|
GetPtrTypeSize (TokenNumber, &MaxSize, PeiPcdDb);
|
||||||
} else {
|
} else {
|
||||||
MaxSize = *Size;
|
MaxSize = *Size;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue