diff options
author | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-08-26 01:54:49 +0000 |
---|---|---|
committer | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-08-26 01:54:49 +0000 |
commit | ba944801a988dddf3ed217c72c8d880d0f03d150 (patch) | |
tree | abb1adb316e2e43d1e55499b448c93b51c5d9353 /MdeModulePkg | |
parent | ce2f13a34108f012b2cd13c7072f1fa34c20dac9 (diff) | |
download | edk2-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.c | 6 |
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;
|