mirror of https://github.com/acidanthera/audk.git
Add pointer check for NULL before dereference it.
Signed-off-by: sfu5 Reviewed-by: tye git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12537 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
cf6a8f1453
commit
3b4151bcb4
|
@ -846,6 +846,7 @@ UpdateVariableCache (
|
||||||
// If size of data changes, allocate pool and copy data.
|
// If size of data changes, allocate pool and copy data.
|
||||||
//
|
//
|
||||||
Entry->Data = AllocatePool (DataSize);
|
Entry->Data = AllocatePool (DataSize);
|
||||||
|
ASSERT (Entry->Data != NULL);
|
||||||
Entry->DataSize = DataSize;
|
Entry->DataSize = DataSize;
|
||||||
CopyMem (Entry->Data, Data, DataSize);
|
CopyMem (Entry->Data, Data, DataSize);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1591,12 +1591,11 @@ UpdateVariable (
|
||||||
NextVariable->MonotonicCount = MonotonicCount;
|
NextVariable->MonotonicCount = MonotonicCount;
|
||||||
SetMem (&NextVariable->TimeStamp, sizeof (EFI_TIME), 0);
|
SetMem (&NextVariable->TimeStamp, sizeof (EFI_TIME), 0);
|
||||||
|
|
||||||
if (((Attributes & EFI_VARIABLE_APPEND_WRITE) == 0) &&
|
if (((Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) != 0) &&
|
||||||
((Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) != 0)) {
|
TimeStamp != NULL) {
|
||||||
CopyMem (&NextVariable->TimeStamp, TimeStamp, sizeof (EFI_TIME));
|
if ((Attributes & EFI_VARIABLE_APPEND_WRITE) == 0) {
|
||||||
} else if (
|
CopyMem (&NextVariable->TimeStamp, TimeStamp, sizeof (EFI_TIME));
|
||||||
((Attributes & EFI_VARIABLE_APPEND_WRITE) != 0) &&
|
} else {
|
||||||
((Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) != 0)) {
|
|
||||||
//
|
//
|
||||||
// In the case when the EFI_VARIABLE_APPEND_WRITE attribute is set, only
|
// In the case when the EFI_VARIABLE_APPEND_WRITE attribute is set, only
|
||||||
// when the new TimeStamp value is later than the current timestamp associated
|
// when the new TimeStamp value is later than the current timestamp associated
|
||||||
|
@ -1605,6 +1604,7 @@ UpdateVariable (
|
||||||
if (CompareTimeStamp (&Variable->CurrPtr->TimeStamp, TimeStamp)) {
|
if (CompareTimeStamp (&Variable->CurrPtr->TimeStamp, TimeStamp)) {
|
||||||
CopyMem (&NextVariable->TimeStamp, TimeStamp, sizeof (EFI_TIME));
|
CopyMem (&NextVariable->TimeStamp, TimeStamp, sizeof (EFI_TIME));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue