diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Echo.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Echo.c
index febfc000b3..a34b2a9c84 100644
--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Echo.c
+++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/Echo.c
@@ -1,7 +1,7 @@
/** @file
Main file for Echo shell level 3 function.
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -40,8 +40,12 @@ ShellCommandRunEcho (
SHELL_STATUS ShellStatus;
UINTN ParamCount;
CHAR16 *ProblemParam;
+ UINTN Size;
+ CHAR16 *PrintString;
+ Size = 0;
ProblemParam = NULL;
+ PrintString = NULL;
ShellStatus = SHELL_SUCCESS;
//
@@ -96,13 +100,13 @@ ShellCommandRunEcho (
; ShellCommandLineGetRawValue(Package, ParamCount) != NULL
; ParamCount++
) {
+ StrnCatGrow(&PrintString, &Size, ShellCommandLineGetRawValue(Package, ParamCount), 0);
if (ShellCommandLineGetRawValue(Package, ParamCount+1) != NULL) {
- ShellPrintEx(-1, -1, L"%s ", ShellCommandLineGetRawValue(Package, ParamCount));
- } else {
- ShellPrintEx(-1, -1, L"%s", ShellCommandLineGetRawValue(Package, ParamCount));
- }
+ StrnCatGrow(&PrintString, &Size, L" ", 0);
+ }
}
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CRLF), gShellLevel3HiiHandle);
+ ShellPrintEx(-1, -1, L"%s\r\n", PrintString);
+ SHELL_FREE_NON_NULL(PrintString);
}
//