]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
MdeModulePkg: Add error handling when IP address is Class E
[mirror_edk2.git] / MdeModulePkg / Universal / DisplayEngineDxe / InputHandler.c
index 400b93427caa162e0310605da3766764082a228e..d02c0bf0742433ef5f0ba2187dad22a410539848 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Implementation for handling user input from the User Interfaces.\r
 \r
-Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -524,6 +524,7 @@ GetNumericInput (
 \r
   Question      = MenuOption->ThisTag;\r
   QuestionValue = &Question->CurrentValue;\r
+  ZeroMem (InputText, MAX_NUMERIC_INPUT_WIDTH * sizeof (CHAR16));\r
 \r
   //\r
   // Only two case, user can enter to this function: Enter and +/- case.\r
@@ -690,16 +691,17 @@ GetNumericInput (
       if (MenuOption->Sequence == 0) {\r
         InputText[0] = LEFT_NUMERIC_DELIMITER;\r
         SetUnicodeMem (InputText + 1, InputWidth, L' ');\r
-      } else {\r
+        InputText[InputWidth + 1] = DATE_SEPARATOR;\r
+        InputText[InputWidth + 2] = L'\0';\r
+      } else  if (MenuOption->Sequence == 1){\r
         SetUnicodeMem (InputText, InputWidth, L' ');\r
-      }\r
-\r
-      if (MenuOption->Sequence == 2) {\r
-        InputText[InputWidth + 1] = RIGHT_NUMERIC_DELIMITER;\r
+        InputText[InputWidth] = DATE_SEPARATOR;\r
+        InputText[InputWidth + 1] = L'\0';\r
       } else {\r
-        InputText[InputWidth + 1] = DATE_SEPARATOR;\r
+        SetUnicodeMem (InputText, InputWidth, L' ');\r
+        InputText[InputWidth] = RIGHT_NUMERIC_DELIMITER;\r
+        InputText[InputWidth + 1] = L'\0';\r
       }\r
-      InputText[InputWidth + 2] = L'\0';\r
 \r
       PrintStringAt (Column, Row, InputText);\r
       if (MenuOption->Sequence == 0) {\r
@@ -713,16 +715,17 @@ GetNumericInput (
       if (MenuOption->Sequence == 0) {\r
         InputText[0] = LEFT_NUMERIC_DELIMITER;\r
         SetUnicodeMem (InputText + 1, InputWidth, L' ');\r
-      } else {\r
+        InputText[InputWidth + 1] = TIME_SEPARATOR;\r
+        InputText[InputWidth + 2] = L'\0';\r
+      } else if (MenuOption->Sequence == 1){\r
         SetUnicodeMem (InputText, InputWidth, L' ');\r
-      }\r
-\r
-      if (MenuOption->Sequence == 2) {\r
-        InputText[InputWidth + 1] = RIGHT_NUMERIC_DELIMITER;\r
+        InputText[InputWidth] = TIME_SEPARATOR;\r
+        InputText[InputWidth + 1] = L'\0';\r
       } else {\r
-        InputText[InputWidth + 1] = TIME_SEPARATOR;\r
+        SetUnicodeMem (InputText, InputWidth, L' ');\r
+        InputText[InputWidth] = RIGHT_NUMERIC_DELIMITER;\r
+        InputText[InputWidth + 1] = L'\0';\r
       }\r
-      InputText[InputWidth + 2] = L'\0';\r
 \r
       PrintStringAt (Column, Row, InputText);\r
       if (MenuOption->Sequence == 0) {\r