summaryrefslogtreecommitdiff
path: root/SecurityPkg
diff options
context:
space:
mode:
authorsfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-14 05:19:25 +0000
committersfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-14 05:19:25 +0000
commit3b4151bcb43ec74e0a350c7b93f75531cc8df003 (patch)
tree35d658d041e3f5b3929bb75229eb55cc3068be96 /SecurityPkg
parentcf6a8f1453bed5aca0ac32b4038c83ce62b77327 (diff)
downloadedk2-platforms-3b4151bcb43ec74e0a350c7b93f75531cc8df003.tar.xz
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
Diffstat (limited to 'SecurityPkg')
-rw-r--r--SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/Variable.c1
-rw-r--r--SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c12
2 files changed, 7 insertions, 6 deletions
diff --git a/SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/Variable.c b/SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/Variable.c
index d6c6686351..2be925d236 100644
--- a/SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/Variable.c
+++ b/SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/Variable.c
@@ -846,6 +846,7 @@ UpdateVariableCache (
// If size of data changes, allocate pool and copy data.
//
Entry->Data = AllocatePool (DataSize);
+ ASSERT (Entry->Data != NULL);
Entry->DataSize = DataSize;
CopyMem (Entry->Data, Data, DataSize);
}
diff --git a/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c b/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c
index df8b30a63e..0846b2a21b 100644
--- a/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c
+++ b/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c
@@ -1591,12 +1591,11 @@ UpdateVariable (
NextVariable->MonotonicCount = MonotonicCount;
SetMem (&NextVariable->TimeStamp, sizeof (EFI_TIME), 0);
- if (((Attributes & EFI_VARIABLE_APPEND_WRITE) == 0) &&
- ((Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) != 0)) {
- CopyMem (&NextVariable->TimeStamp, TimeStamp, sizeof (EFI_TIME));
- } else if (
- ((Attributes & EFI_VARIABLE_APPEND_WRITE) != 0) &&
- ((Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) != 0)) {
+ if (((Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) != 0) &&
+ TimeStamp != NULL) {
+ if ((Attributes & EFI_VARIABLE_APPEND_WRITE) == 0) {
+ CopyMem (&NextVariable->TimeStamp, TimeStamp, sizeof (EFI_TIME));
+ } else {
//
// 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
@@ -1605,6 +1604,7 @@ UpdateVariable (
if (CompareTimeStamp (&Variable->CurrPtr->TimeStamp, TimeStamp)) {
CopyMem (&NextVariable->TimeStamp, TimeStamp, sizeof (EFI_TIME));
}
+ }
}
//