From b347c1bceb394b394ce26500bb900417a730194c Mon Sep 17 00:00:00 2001 From: gikidy Date: Fri, 15 May 2009 03:39:01 +0000 Subject: [PATCH] Add check for NULL pointer. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8318 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/SetupBrowserDxe/IfrParse.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c index 745e20d9ea..69e35fef23 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c @@ -1224,12 +1224,13 @@ ParseOpCodes ( // Create Statement // CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm); + ASSERT (CurrentStatement != NULL); CopyMem (&CurrentStatement->DefaultId, &((EFI_IFR_RESET_BUTTON *) OpCodeData)->DefaultId, sizeof (EFI_DEFAULT_ID)); break; case EFI_IFR_REF_OP: CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm); - + ASSERT (CurrentStatement != NULL); CopyMem (&CurrentStatement->RefFormId, &((EFI_IFR_REF *) OpCodeData)->FormId, sizeof (EFI_FORM_ID)); if (OpCodeLength >= sizeof (EFI_IFR_REF2)) { CopyMem (&CurrentStatement->RefQuestionId, &((EFI_IFR_REF2 *) OpCodeData)->QuestionId, sizeof (EFI_QUESTION_ID)); @@ -1298,7 +1299,8 @@ ParseOpCodes ( case EFI_IFR_ORDERED_LIST_OP: CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm); - + ASSERT(CurrentStatement != NULL); + CurrentStatement->Flags = ((EFI_IFR_ORDERED_LIST *) OpCodeData)->Flags; CurrentStatement->MaxContainers = ((EFI_IFR_ORDERED_LIST *) OpCodeData)->MaxContainers; CurrentStatement->StorageWidth = (UINT16)(CurrentStatement->MaxContainers * sizeof (UINT8)); @@ -1319,7 +1321,8 @@ ParseOpCodes ( case EFI_IFR_CHECKBOX_OP: CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm); - + ASSERT(CurrentStatement != NULL); + CurrentStatement->Flags = ((EFI_IFR_CHECKBOX *) OpCodeData)->Flags; CurrentStatement->StorageWidth = sizeof (BOOLEAN); CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_BOOLEAN; @@ -1330,7 +1333,7 @@ ParseOpCodes ( case EFI_IFR_STRING_OP: CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm); - + ASSERT (CurrentStatement != NULL); // // MinSize is the minimum number of characters that can be accepted for this opcode, // MaxSize is the maximum number of characters that can be accepted for this opcode. @@ -1349,7 +1352,7 @@ ParseOpCodes ( case EFI_IFR_PASSWORD_OP: CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm); - + ASSERT (CurrentStatement != NULL); // // MinSize is the minimum number of characters that can be accepted for this opcode, // MaxSize is the maximum number of characters that can be accepted for this opcode. @@ -1367,7 +1370,8 @@ ParseOpCodes ( case EFI_IFR_DATE_OP: CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm); - + ASSERT(CurrentStatement != NULL); + CurrentStatement->Flags = ((EFI_IFR_DATE *) OpCodeData)->Flags; CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_DATE; @@ -1386,7 +1390,8 @@ ParseOpCodes ( case EFI_IFR_TIME_OP: CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm); - + ASSERT(CurrentStatement != NULL); + CurrentStatement->Flags = ((EFI_IFR_TIME *) OpCodeData)->Flags; CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_TIME; -- 2.39.2