/** @file\r
Implementation for handling user input from the User Interfaces.\r
\r
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2015, 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
UINTN Maximum;\r
FORM_DISPLAY_ENGINE_STATEMENT *Question;\r
BOOLEAN IsPassword;\r
+ UINTN MaxLen;\r
\r
DimensionsWidth = gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn;\r
DimensionsHeight = gStatementDimensions.BottomRow - gStatementDimensions.TopRow;\r
IsPassword = FALSE;\r
}\r
\r
- TempString = AllocateZeroPool ((Maximum + 1)* sizeof (CHAR16));\r
+ MaxLen = Maximum + 1;\r
+ TempString = AllocateZeroPool (MaxLen * sizeof (CHAR16));\r
ASSERT (TempString);\r
\r
if (ScreenSize < (Maximum + 1)) {\r
return EFI_DEVICE_ERROR;\r
}\r
\r
- break;\r
\r
case CHAR_BACKSPACE:\r
if (StringPtr[0] != CHAR_NULL && CurrentCursor != 0) {\r
//\r
// Effectively truncate string by 1 character\r
//\r
- StrCpy (StringPtr, TempString);\r
+ StrCpyS (StringPtr, MaxLen, TempString);\r
CurrentCursor --;\r
}\r
\r
// If it is the beginning of the string, don't worry about checking maximum limits\r
//\r
if ((StringPtr[0] == CHAR_NULL) && (Key.UnicodeChar != CHAR_BACKSPACE)) {\r
- StrnCpy (StringPtr, &Key.UnicodeChar, 1);\r
+ StrnCpyS (StringPtr, MaxLen, &Key.UnicodeChar, 1);\r
CurrentCursor++;\r
} else if ((GetStringWidth (StringPtr) < ((Maximum + 1) * sizeof (CHAR16))) && (Key.UnicodeChar != CHAR_BACKSPACE)) {\r
KeyPad[0] = Key.UnicodeChar;\r
TempString[Index] = StringPtr[Index];\r
}\r
TempString[Index] = CHAR_NULL;\r
- StrCat (TempString, KeyPad);\r
- StrCat (TempString, StringPtr + CurrentCursor);\r
- StrCpy (StringPtr, TempString);\r
+ StrCatS (TempString, MaxLen, KeyPad);\r
+ StrCatS (TempString, MaxLen, StringPtr + CurrentCursor);\r
+ StrCpyS (StringPtr, MaxLen, TempString);\r
} else {\r
- StrCat (StringPtr, KeyPad);\r
+ StrCatS (StringPtr, MaxLen, KeyPad);\r
}\r
CurrentCursor++;\r
}\r
}\r
\r
goto EnterCarriageReturn;\r
- break;\r
\r
case SCAN_UP:\r
case SCAN_DOWN:\r
}\r
\r
return EFI_SUCCESS;\r
- break;\r
\r
case CHAR_BACKSPACE:\r
if (ManualInput) {\r
CopyMem (TempStringPtr, StringPtr, (sizeof (CHAR16) * (PopUpWidth - 5)));\r
FreePool (StringPtr);\r
StringPtr = TempStringPtr;\r
- StrCat (StringPtr, L"...");\r
+ StrCatS (StringPtr, PopUpWidth - 1, L"...");\r
}\r
\r
if (Index == HighlightOptionIndex) {\r