summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorEric Dong <eric.dong@intel.com>2014-07-14 11:01:17 +0000
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2014-07-14 11:01:17 +0000
commite77d2f9db2d93896c882edfc1b239e04620503f1 (patch)
tree63d69fa0fae48ffbc711217c5b264ddf2a194c33 /MdeModulePkg
parent93551a01feb97510c2417035cee75d63834e458d (diff)
downloadedk2-platforms-e77d2f9db2d93896c882edfc1b239e04620503f1.tar.xz
Add check to make code more safely.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Eric Dong <eric.dong@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15655 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Setup.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index 92474cd282..ff3b7e5b4d 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -2590,6 +2590,7 @@ FindQuestionFromProgress (
// For Name/Value type, Skip the ConfigHdr part.
//
EndStr = StrStr (Progress, L"PATH=");
+ ASSERT (EndStr != NULL);
while (*EndStr != '&') {
EndStr++;
}
@@ -2600,6 +2601,7 @@ FindQuestionFromProgress (
// For Buffer type, Skip the ConfigHdr part.
//
EndStr = StrStr (Progress, L"&OFFSET=");
+ ASSERT (EndStr != NULL);
*EndStr = '\0';
}
@@ -2615,6 +2617,7 @@ FindQuestionFromProgress (
// here, just keep the "Fred" string.
//
EndStr = StrStr (Progress, L"=");
+ ASSERT (EndStr != NULL);
*EndStr = '\0';
} else {
//
@@ -2622,6 +2625,7 @@ FindQuestionFromProgress (
// here, just keep the "OFFSET=0x####&WIDTH=0x####" string.
//
EndStr = StrStr (Progress, L"&VALUE=");
+ ASSERT (EndStr != NULL);
*EndStr = '\0';
}
@@ -4246,9 +4250,8 @@ IsQuestionValueChanged (
}
CopyMem (&Question->HiiValue, &BackUpValue, sizeof (EFI_HII_VALUE));
- CopyMem (Question->BufferValue, BackUpBuffer, BufferWidth);
-
if (BackUpBuffer != NULL) {
+ CopyMem (Question->BufferValue, BackUpBuffer, BufferWidth);
FreePool (BackUpBuffer);
}