diff options
author | Dun Tan <dun.tan@intel.com> | 2024-07-29 09:32:19 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-07-29 06:43:27 +0000 |
commit | 43e2395c1b130540820957305451340e1fff81e4 (patch) | |
tree | 3a673c2a2cc48ba6d86eb28bcf6996932265f4ea /MdeModulePkg | |
parent | 51edd4830d822e70b96a8548d0d89383e12bc4c0 (diff) | |
download | edk2-43e2395c1b130540820957305451340e1fff81e4.tar.gz |
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>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Universal/Variable/Pei/Variable.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/MdeModulePkg/Universal/Variable/Pei/Variable.c b/MdeModulePkg/Universal/Variable/Pei/Variable.c index 26f95c6d95..9f3d43486c 100644 --- a/MdeModulePkg/Universal/Variable/Pei/Variable.c +++ b/MdeModulePkg/Universal/Variable/Pei/Variable.c @@ -1336,6 +1336,7 @@ CalculateHobVariableCacheSize ( VARIABLE_STORE_HEADER *VariableStoreHeader;
VariableStoreHeader = NULL;
+ ZeroMem (&StoreInfo, sizeof (VARIABLE_STORE_INFO));
GetHobVariableStore (&StoreInfo, &VariableStoreHeader);
if (VariableStoreHeader == NULL) {
|