summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal
diff options
context:
space:
mode:
authorDandan Bi <dandan.bi@intel.com>2017-02-09 21:17:34 +0800
committerHao Wu <hao.a.wu@intel.com>2017-02-21 19:19:05 +0800
commit5c793e7703146e4c20d8e0074e7908f723d499b0 (patch)
tree971ba524985928893591c40dd12486290e493ad1 /MdeModulePkg/Universal
parent087132a84a43c1939550122f10e234ab2e2c324d (diff)
downloadedk2-5c793e7703146e4c20d8e0074e7908f723d499b0.tar.gz
edk2-5c793e7703146e4c20d8e0074e7908f723d499b0.tar.bz2
edk2-5c793e7703146e4c20d8e0074e7908f723d499b0.zip
MdeMoudlePkg/DisplayEngine: Fix incorrect index used in array "InputText"
When set value to the array "InputText", the index was used incorrectly. And the array "InputText" is not initialized. These will cause some value in the array is random, so it will be shown incorrectly sometimes. This patch is to fix this issue. https://bugzilla.tianocore.org/show_bug.cgi?id=358 Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Wang Cloud <winggundum82@163.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>
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r--MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c b/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
index 400b93427c..d02c0bf074 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
@@ -1,7 +1,7 @@
/** @file
Implementation for handling user input from the User Interfaces.
-Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -524,6 +524,7 @@ GetNumericInput (
Question = MenuOption->ThisTag;
QuestionValue = &Question->CurrentValue;
+ ZeroMem (InputText, MAX_NUMERIC_INPUT_WIDTH * sizeof (CHAR16));
//
// Only two case, user can enter to this function: Enter and +/- case.
@@ -690,16 +691,17 @@ GetNumericInput (
if (MenuOption->Sequence == 0) {
InputText[0] = LEFT_NUMERIC_DELIMITER;
SetUnicodeMem (InputText + 1, InputWidth, L' ');
- } else {
+ InputText[InputWidth + 1] = DATE_SEPARATOR;
+ InputText[InputWidth + 2] = L'\0';
+ } else if (MenuOption->Sequence == 1){
SetUnicodeMem (InputText, InputWidth, L' ');
- }
-
- if (MenuOption->Sequence == 2) {
- InputText[InputWidth + 1] = RIGHT_NUMERIC_DELIMITER;
+ InputText[InputWidth] = DATE_SEPARATOR;
+ InputText[InputWidth + 1] = L'\0';
} else {
- InputText[InputWidth + 1] = DATE_SEPARATOR;
+ SetUnicodeMem (InputText, InputWidth, L' ');
+ InputText[InputWidth] = RIGHT_NUMERIC_DELIMITER;
+ InputText[InputWidth + 1] = L'\0';
}
- InputText[InputWidth + 2] = L'\0';
PrintStringAt (Column, Row, InputText);
if (MenuOption->Sequence == 0) {
@@ -713,16 +715,17 @@ GetNumericInput (
if (MenuOption->Sequence == 0) {
InputText[0] = LEFT_NUMERIC_DELIMITER;
SetUnicodeMem (InputText + 1, InputWidth, L' ');
- } else {
+ InputText[InputWidth + 1] = TIME_SEPARATOR;
+ InputText[InputWidth + 2] = L'\0';
+ } else if (MenuOption->Sequence == 1){
SetUnicodeMem (InputText, InputWidth, L' ');
- }
-
- if (MenuOption->Sequence == 2) {
- InputText[InputWidth + 1] = RIGHT_NUMERIC_DELIMITER;
+ InputText[InputWidth] = TIME_SEPARATOR;
+ InputText[InputWidth + 1] = L'\0';
} else {
- InputText[InputWidth + 1] = TIME_SEPARATOR;
+ SetUnicodeMem (InputText, InputWidth, L' ');
+ InputText[InputWidth] = RIGHT_NUMERIC_DELIMITER;
+ InputText[InputWidth + 1] = L'\0';
}
- InputText[InputWidth + 2] = L'\0';
PrintStringAt (Column, Row, InputText);
if (MenuOption->Sequence == 0) {