mirror of https://github.com/acidanthera/audk.git
ArmPlatformPkg/Bds: Moved the PrintLib() after forcing the last character to be null
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
This commit is contained in:
parent
9d94fa2da2
commit
4076165359
|
@ -29,13 +29,13 @@ EditHIInputStr (
|
|||
// The command line must be at least one character long
|
||||
ASSERT (MaxCmdLine > 0);
|
||||
|
||||
Print (CmdLine);
|
||||
|
||||
// Ensure the last character of the buffer is the NULL character
|
||||
CmdLine[MaxCmdLine - 1] = '\0';
|
||||
|
||||
Print (CmdLine);
|
||||
|
||||
// To prevent a buffer overflow, we only allow to enter (MaxCmdLine-1) characters
|
||||
for (CmdLineIndex = StrLen (CmdLine); CmdLineIndex < MaxCmdLine-1; ) {
|
||||
for (CmdLineIndex = StrLen (CmdLine); CmdLineIndex < MaxCmdLine - 1; ) {
|
||||
Status = gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &WaitIndex);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
|
Loading…
Reference in New Issue