summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2009-01-20 12:55:02 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2009-01-20 12:55:02 +0000
commit40a06b0ca865395b938f9411ab1b9a2c718f1c5b (patch)
tree072c1682191b925d3aa4f836018b7b0195b72963 /MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c
parent7bfc66a284e167ef9e63855a2fedee3559933496 (diff)
downloadedk2-platforms-40a06b0ca865395b938f9411ab1b9a2c718f1c5b.tar.xz
K8:
1) Replace immediate constant with MACRO. 2) Add in ASSERT for NULL before dereferencing pointers and after memory allocation. 3) Add a return statement in ProcessOptions to handle the mismatch between the value stored and the opcode for one-of-option in orderedlist opcode. This case occurs when the one-of-optoin entry in OrderedList get deleted. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7320 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c')
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c b/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c
index d72578ddfb..8ac531f09c 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c
@@ -452,6 +452,7 @@ ProcessOptions (
FreePool (*OptionString);
*OptionString = NULL;
+ return EFI_NOT_FOUND;
}
if ((OneOfOption->SuppressExpression != NULL) &&
@@ -722,6 +723,8 @@ ProcessOptions (
}
TempString = AllocateCopyPool ((Maximum + 1) * sizeof (CHAR16), Question->BufferValue);
+ ASSERT (TempString != NULL);
+
TempString[Maximum] = L'\0';
if (StrCmp (StringPtr, TempString) != 0) {
@@ -877,6 +880,7 @@ ProcessHelpString (
//
AllocateSize = 0x20;
IndexArray = AllocatePool (AllocateSize * sizeof (UINTN) * 3);
+ ASSERT (IndexArray != NULL);
if (*FormattedString != NULL) {
FreePool (*FormattedString);
@@ -1012,6 +1016,7 @@ ProcessHelpString (
VirtualLineCount = RowCount * (LineCount / RowCount + (LineCount % RowCount > 0));
*FormattedString = AllocateZeroPool (VirtualLineCount * (BlockWidth + 1) * sizeof (CHAR16) * 2);
+ ASSERT (*FormattedString != NULL);
for (CurrIndex = 0; CurrIndex < LineCount; CurrIndex ++) {
*(*FormattedString + CurrIndex * 2 * (BlockWidth + 1)) = (CHAR16) ((IndexArray[CurrIndex*3+2] == 2) ? WIDE_CHAR : NARROW_CHAR);