summaryrefslogtreecommitdiff
path: root/ShellPkg/Application
diff options
context:
space:
mode:
authorJaben Carsey <jaben.carsey@intel.com>2013-12-19 22:03:37 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2013-12-19 22:03:37 +0000
commit404b3f439492fac48207f5a8cb7ecc89f4287100 (patch)
tree75cfdfd417c0f9f91480ba3c1690185f4761e819 /ShellPkg/Application
parente3eb7d825adae351f1a45e7809c8506b364ee059 (diff)
downloadedk2-platforms-404b3f439492fac48207f5a8cb7ecc89f4287100.tar.xz
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 <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
Diffstat (limited to 'ShellPkg/Application')
-rw-r--r--ShellPkg/Application/Shell/Shell.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c
index 5e3af1d056..fcf4962e82 100644
--- a/ShellPkg/Application/Shell/Shell.c
+++ b/ShellPkg/Application/Shell/Shell.c
@@ -91,9 +91,9 @@ TrimSpaces(
}
//
- // 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;
}