mirror of https://github.com/acidanthera/audk.git
MdeModulePkg Variable: Read MonotonicCount by ReadUnaligned64()
As variable HEADER_ALIGNMENT = 4, the MonotonicCount in AUTHENTICATED_VARIABLE_HEADER may be not UINT64 aligned, so go to use ReadUnaligned64() to ensure read data correctly. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18064 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
88656abf1b
commit
cdc83ccf71
|
@ -67,7 +67,7 @@ VariableExLibFindVariable (
|
||||||
if (mVariableModuleGlobal->VariableGlobal.AuthFormat) {
|
if (mVariableModuleGlobal->VariableGlobal.AuthFormat) {
|
||||||
AuthVariable = (AUTHENTICATED_VARIABLE_HEADER *) Variable.CurrPtr;
|
AuthVariable = (AUTHENTICATED_VARIABLE_HEADER *) Variable.CurrPtr;
|
||||||
AuthVariableInfo->PubKeyIndex = AuthVariable->PubKeyIndex;
|
AuthVariableInfo->PubKeyIndex = AuthVariable->PubKeyIndex;
|
||||||
AuthVariableInfo->MonotonicCount = AuthVariable->MonotonicCount;
|
AuthVariableInfo->MonotonicCount = ReadUnaligned64 (&(AuthVariable->MonotonicCount));
|
||||||
AuthVariableInfo->TimeStamp = &AuthVariable->TimeStamp;
|
AuthVariableInfo->TimeStamp = &AuthVariable->TimeStamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ VariableExLibFindNextVariable (
|
||||||
if (mVariableModuleGlobal->VariableGlobal.AuthFormat) {
|
if (mVariableModuleGlobal->VariableGlobal.AuthFormat) {
|
||||||
AuthVariablePtr = (AUTHENTICATED_VARIABLE_HEADER *) VariablePtr;
|
AuthVariablePtr = (AUTHENTICATED_VARIABLE_HEADER *) VariablePtr;
|
||||||
AuthVariableInfo->PubKeyIndex = AuthVariablePtr->PubKeyIndex;
|
AuthVariableInfo->PubKeyIndex = AuthVariablePtr->PubKeyIndex;
|
||||||
AuthVariableInfo->MonotonicCount = AuthVariablePtr->MonotonicCount;
|
AuthVariableInfo->MonotonicCount = ReadUnaligned64 (&(AuthVariablePtr->MonotonicCount));
|
||||||
AuthVariableInfo->TimeStamp = &AuthVariablePtr->TimeStamp;
|
AuthVariableInfo->TimeStamp = &AuthVariablePtr->TimeStamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue