diff mbox

[edk2,2/3] OvmfPkg: PlatformDxe: Add sanity check for HiiConfigAccess

Message ID 1433160495-10385-3-git-send-email-heyi.guo@linaro.org
State New
Headers show

Commit Message

gary guo June 1, 2015, 12:08 p.m. UTC
During UEFI SCT, it will throw an exception because "Progress" is
passed in with NULL and RouteConfig will try to access the string at
*(EFI_STRING *0), i.e. 0xFFFFFFFF14000400.

Add sanity check for ExtractConfig and RouteConfig to avoid NULL
pointer dereference.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
---
 OvmfPkg/PlatformDxe/Platform.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox

Patch

diff --git a/OvmfPkg/PlatformDxe/Platform.c b/OvmfPkg/PlatformDxe/Platform.c
index 4ec327e..35fabf8 100644
--- a/OvmfPkg/PlatformDxe/Platform.c
+++ b/OvmfPkg/PlatformDxe/Platform.c
@@ -234,6 +234,11 @@  ExtractConfig (
   MAIN_FORM_STATE MainFormState;
   EFI_STATUS      Status;
 
+  if (Progress == NULL || Results == NULL)
+  {
+    return EFI_INVALID_PARAMETER;
+  }
+
   DEBUG ((EFI_D_VERBOSE, "%a: Request=\"%s\"\n", __FUNCTION__, Request));
 
   Status = PlatformConfigToFormState (&MainFormState);
@@ -327,6 +332,11 @@  RouteConfig (
   UINTN           BlockSize;
   EFI_STATUS      Status;
 
+  if (Configuration == NULL || Progress == NULL)
+  {
+    return EFI_INVALID_PARAMETER;
+  }
+
   DEBUG ((EFI_D_VERBOSE, "%a: Configuration=\"%s\"\n", __FUNCTION__,
     Configuration));