Revision: 14430
          http://sourceforge.net/p/edk2/code/14430
Author:   oliviermartin
Date:     2013-06-19 18:00:46 +0000 (Wed, 19 Jun 2013)
Log Message:
-----------
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 <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ArmPlatformPkg/Bds/BdsHelper.c

Modified: trunk/edk2/ArmPlatformPkg/Bds/BdsHelper.c
===================================================================
--- trunk/edk2/ArmPlatformPkg/Bds/BdsHelper.c   2013-06-19 17:58:26 UTC (rev 
14429)
+++ trunk/edk2/ArmPlatformPkg/Bds/BdsHelper.c   2013-06-19 18:00:46 UTC (rev 
14430)
@@ -29,13 +29,13 @@
   // 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);
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to