]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: fix whitespace character trimming
authorJaben Carsey <jaben.carsey@intel.com>
Thu, 19 Dec 2013 22:03:37 +0000 (22:03 +0000)
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 19 Dec 2013 22:03:37 +0000 (22:03 +0000)
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 <jaben.carsey@intel.com>
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15009 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Application/Shell/Shell.c

index 5e3af1d0565644add4095a1bb42a8288434cdc9f..fcf4962e82560ca15a64393446e9d29a2369b806 100644 (file)
@@ -91,9 +91,9 @@ TrimSpaces(
   }\r
 \r
   //\r
-  // Remove any spaces at the end of the (*String).\r
+  // Remove any spaces and tabs at the end of the (*String).\r
   //\r
-  while ((*String)[StrLen((*String))-1] == L' ') {\r
+  while ((StrLen (*String) > 0) && (((*String)[StrLen((*String))-1] == L' ') || ((*String)[StrLen((*String))-1] == L'\t'))) {\r
     (*String)[StrLen((*String))-1] = CHAR_NULL;\r
   }\r
 \r