]> git.proxmox.com Git - mirror_edk2.git/blobdiff - FmpDevicePkg/FmpDxe/VariableSupport.c
FmpDevicePkg FmpDxe: Add NULL check to return Value from GetVariable2
[mirror_edk2.git] / FmpDevicePkg / FmpDxe / VariableSupport.c
index c15178d09914c21ba484663a328d00401d72e1f7..6a4330ad6a832f854617cd7ae669323e721e6472 100644 (file)
@@ -72,7 +72,7 @@ GetVersionFromVariable (
   Version = DEFAULT_VERSION;\r
 \r
   Status = GetVariable2 (VARNAME_VERSION, &gEfiCallerIdGuid, (VOID **)&Value, &Size);\r
-  if (EFI_ERROR (Status)) {\r
+  if (EFI_ERROR (Status) || (Value == NULL)) {\r
     DEBUG ((DEBUG_ERROR, "Failed to get the Version from variable.  Status = %r\n", Status));\r
     return Version;\r
   }\r
@@ -125,7 +125,7 @@ GetLowestSupportedVersionFromVariable (
   Version = DEFAULT_LOWESTSUPPORTEDVERSION;\r
 \r
   Status = GetVariable2 (VARNAME_LSV, &gEfiCallerIdGuid, (VOID **)&Value, &Size);\r
-  if (EFI_ERROR (Status)) {\r
+  if (EFI_ERROR (Status) || (Value == NULL)) {\r
     DEBUG ((DEBUG_WARN, "Warning: Failed to get the Lowest Supported Version from variable.  Status = %r\n", Status));\r
     return Version;\r
   }\r
@@ -177,7 +177,7 @@ GetLastAttemptStatusFromVariable (
   LastAttemptStatus     = DEFAULT_LASTATTEMPT;\r
 \r
   Status = GetVariable2 (VARNAME_LASTATTEMPTSTATUS, &gEfiCallerIdGuid, (VOID **)&Value, &Size);\r
-  if (EFI_ERROR (Status)) {\r
+  if (EFI_ERROR (Status) || (Value == NULL)) {\r
     DEBUG ((DEBUG_WARN, "Warning: Failed to get the Last Attempt Status from variable.  Status = %r\n", Status));\r
     return LastAttemptStatus;\r
   }\r
@@ -233,7 +233,7 @@ GetLastAttemptVersionFromVariable (
   Version = DEFAULT_LASTATTEMPT;\r
 \r
   Status = GetVariable2 (VARNAME_LASTATTEMPTVERSION, &gEfiCallerIdGuid, (VOID **)&Value, &Size);\r
-  if (EFI_ERROR (Status)) {\r
+  if (EFI_ERROR (Status) || (Value == NULL)) {\r
     DEBUG ((DEBUG_WARN, "Warning: Failed to get the Last Attempt Version from variable.  Status = %r\n", Status));\r
     return Version;\r
   }\r