summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
diff options
context:
space:
mode:
authorDandan Bi <dandan.bi@intel.com>2016-05-10 18:51:44 +0800
committerStar Zeng <star.zeng@intel.com>2016-05-17 14:38:05 +0800
commit05b2f9c94e0c0b663ff2d2fb55397d8215eeb3f5 (patch)
tree015c6b762b6dd1167af975b7d2844afb599d5273 /MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
parentfa209e8c20d787c35dbb90c3c33f6db959aa1252 (diff)
downloadedk2-05b2f9c94e0c0b663ff2d2fb55397d8215eeb3f5.zip
edk2-05b2f9c94e0c0b663ff2d2fb55397d8215eeb3f5.tar.gz
edk2-05b2f9c94e0c0b663ff2d2fb55397d8215eeb3f5.tar.bz2
MdeModulePkg/SetupBrowser: Clean the BufferValue for string before use
When copy new string content to BufferValue, need to clean the BufferValue firstly, or the BufferValue may contain some content that doesn't belong to the new string. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'MdeModulePkg/Universal/SetupBrowserDxe/Setup.c')
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Setup.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index f649e04..6b38547 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -4100,6 +4100,7 @@ GetQuestionDefault (
ASSERT (StrLen (NewString) * sizeof (CHAR16) <= Question->StorageWidth);
if (StrLen (NewString) * sizeof (CHAR16) <= Question->StorageWidth) {
+ ZeroMem (Question->BufferValue, Question->StorageWidth);
CopyMem (Question->BufferValue, NewString, StrSize (NewString));
} else {
CopyMem (Question->BufferValue, NewString, Question->StorageWidth);
@@ -4170,6 +4171,7 @@ GetQuestionDefault (
return EFI_NOT_FOUND;
}
if (Question->StorageWidth > StrSize (StrValue)) {
+ ZeroMem (Question->BufferValue, Question->StorageWidth);
CopyMem (Question->BufferValue, StrValue, StrSize (StrValue));
} else {
CopyMem (Question->BufferValue, StrValue, Question->StorageWidth);