diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c index d13a89797a..121a80f643 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c @@ -457,6 +457,7 @@ InitializeRequestElement ( if (!Find) { ConfigInfo = AllocateZeroPool(sizeof (FORM_BROWSER_CONFIG_REQUEST)); + ASSERT (ConfigInfo != NULL); ConfigInfo->Signature = FORM_BROWSER_CONFIG_REQUEST_SIGNATURE; ConfigInfo->ConfigRequest = AllocateCopyPool (StrSize (Storage->ConfigHdr), Storage->ConfigHdr); ConfigInfo->SpareStrLen = 0; diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c index 0372f2755b..63996b62a6 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c @@ -1023,7 +1023,9 @@ FindNextMenu ( } Selection->Statement = NULL; - CurrentMenu->QuestionId = 0; + if (CurrentMenu != NULL) { + CurrentMenu->QuestionId = 0; + } Selection->Action = UI_ACTION_EXIT; return TRUE; diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c index dbf6a79b8c..fa721f6d16 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c @@ -2133,6 +2133,7 @@ GetDefaultValueFromAltCfg ( ConfigRequest = NULL; Result = NULL; ConfigResp = NULL; + Value = NULL; Storage = Question->Storage; if ((Storage == NULL) || (Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE)) { @@ -2213,12 +2214,18 @@ GetDefaultValueFromAltCfg ( // // Skip // - Value = StrStr (ConfigResp, L"&VALUE"); if (IsBufferStorage) { + Value = StrStr (ConfigResp, L"&VALUE"); + ASSERT (Value != NULL); // // Skip "&VALUE" // Value = Value + 6; + } else { + Value = StrStr (ConfigResp, Question->VariableName); + ASSERT (Value != NULL); + + Value = Value + StrLen (Question->VariableName); } if (*Value != '=') { Status = EFI_NOT_FOUND;