mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-28 16:14:04 +02:00
MdeModulePkg: fix issue caused by uninitialized variable
This patch is to fix issue caused by uninitialized local variable in Pei/Variable.c. In the fucntion CalculateHobVariableCacheSize(), the local variable VARIABLE_STORE_INFO StoreInfo is used without initialization. When the uninitialized variable is passed to CalculateAuthVarStorageSize() and GetNextVariablePtr(), the field StoreInfo->FtwLastWriteData might be a uninitialized non-zero value. Then the code execution will access the invalid address StoreInfo->FtwLastWriteData->TargetAddress. This might cause issue. So in this commit, the local variable VARIABLE_STORE_INFO StoreInfo is initialized by a ZeroMem() before use. Signed-off-by: Dun Tan <dun.tan@intel.com>
This commit is contained in:
parent
51edd4830d
commit
43e2395c1b
@ -1336,6 +1336,7 @@ CalculateHobVariableCacheSize (
|
|||||||
VARIABLE_STORE_HEADER *VariableStoreHeader;
|
VARIABLE_STORE_HEADER *VariableStoreHeader;
|
||||||
|
|
||||||
VariableStoreHeader = NULL;
|
VariableStoreHeader = NULL;
|
||||||
|
ZeroMem (&StoreInfo, sizeof (VARIABLE_STORE_INFO));
|
||||||
GetHobVariableStore (&StoreInfo, &VariableStoreHeader);
|
GetHobVariableStore (&StoreInfo, &VariableStoreHeader);
|
||||||
|
|
||||||
if (VariableStoreHeader == NULL) {
|
if (VariableStoreHeader == NULL) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user