Revision: 15009
          http://sourceforge.net/p/edk2/code/15009
Author:   jcarsey
Date:     2013-12-19 22:03:37 +0000 (Thu, 19 Dec 2013)
Log Message:
-----------
ShellPkg: fix whitespace character trimming

This makes TrimSpaces() trim tab characters off the end of the string also (not 
just the beginning).  Also updates loop to prevent buffer underrun.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <[email protected]>
Reviewed-by: Erik Bjorge <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ShellPkg/Application/Shell/Shell.c

Modified: trunk/edk2/ShellPkg/Application/Shell/Shell.c
===================================================================
--- trunk/edk2/ShellPkg/Application/Shell/Shell.c       2013-12-19 21:55:13 UTC 
(rev 15008)
+++ trunk/edk2/ShellPkg/Application/Shell/Shell.c       2013-12-19 22:03:37 UTC 
(rev 15009)
@@ -91,9 +91,9 @@
   }
 
   //
-  // Remove any spaces at the end of the (*String).
+  // Remove any spaces and tabs at the end of the (*String).
   //
-  while ((*String)[StrLen((*String))-1] == L' ') {
+  while ((StrLen (*String) > 0) && (((*String)[StrLen((*String))-1] == L' ') 
|| ((*String)[StrLen((*String))-1] == L'\t'))) {
     (*String)[StrLen((*String))-1] = CHAR_NULL;
   }
 

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


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to