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; }