summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2011-08-26 01:54:49 +0000
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2011-08-26 01:54:49 +0000
commitba944801a988dddf3ed217c72c8d880d0f03d150 (patch)
treeabb1adb316e2e43d1e55499b448c93b51c5d9353 /MdeModulePkg
parentce2f13a34108f012b2cd13c7072f1fa34c20dac9 (diff)
downloadedk2-platforms-ba944801a988dddf3ed217c72c8d880d0f03d150.tar.xz
Fixed memory leak and buffer overrun for string op-code.
Signed-off-by:ydong10 Reviewed-by:lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12213 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Setup.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index 65ce5bddce..0b526d0a02 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -2596,7 +2596,11 @@ GetQuestionDefault (
if (StrValue == NULL) {
return EFI_NOT_FOUND;
}
- Question->BufferValue = AllocateCopyPool (StrSize (StrValue), StrValue);
+ if (Question->StorageWidth > StrSize (StrValue)) {
+ CopyMem (Question->BufferValue, StrValue, StrSize (StrValue));
+ } else {
+ CopyMem (Question->BufferValue, StrValue, Question->StorageWidth);
+ }
}
return EFI_SUCCESS;