Print (CmdLine);\r
\r
// To prevent a buffer overflow, we only allow to enter (MaxCmdLine-1) characters\r
- for (CmdLineIndex = StrLen (CmdLine); CmdLineIndex < MaxCmdLine - 1; ) {\r
+ for (CmdLineIndex = StrLen (CmdLine); CmdLineIndex < MaxCmdLine; ) {
Status = gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &WaitIndex);\r
ASSERT_EFI_ERROR (Status);\r
\r
}\r
} else if ((Key.ScanCode == SCAN_ESC) || (Char == 0x1B) || (Char == 0x0)) {\r
return EFI_INVALID_PARAMETER;\r
- } else {\r
+ } else if (CmdLineIndex < (MaxCmdLine-1)) {
CmdLine[CmdLineIndex++] = Key.UnicodeChar;\r
Print (L"%c", Key.UnicodeChar);\r
}\r
\r
while(1) {\r
Print (L"[y/n] ");\r
- // Set MaxCmdLine to 3 to give space for carriage return (when the user\r
- // hits enter) and terminal '\0'.\r
- Status = GetHIInputStr (CmdBoolean, 3);\r
+ Status = GetHIInputStr (CmdBoolean, 2);
if (EFI_ERROR(Status)) {\r
return Status;\r
} else if ((CmdBoolean[0] == L'y') || (CmdBoolean[0] == L'Y')) {\r