That should prevent the risk of buffer overflow.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14430
6f19259b-4bc3-4df7-8a09-
765794883524
// The command line must be at least one character long\r
ASSERT (MaxCmdLine > 0);\r
\r
- Print (CmdLine);\r
-\r
// Ensure the last character of the buffer is the NULL character\r
CmdLine[MaxCmdLine - 1] = '\0';\r
\r
+ 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 - 1; ) {\r
Status = gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &WaitIndex);\r
ASSERT_EFI_ERROR (Status);\r
\r