diff options
author | Chen A Chen <chen.a.chen@intel.com> | 2017-01-04 11:28:03 +0800 |
---|---|---|
committer | Ruiyu Ni <ruiyu.ni@intel.com> | 2017-01-06 20:46:41 +0800 |
commit | 5016d46603addf62656590e83375074abc321f23 (patch) | |
tree | 664de031e65d7eedd5b3fdd95ef5d325870b7048 | |
parent | dd6d0a520eec0fd3fc455ac7345ac0c06095a511 (diff) | |
download | edk2-platforms-5016d46603addf62656590e83375074abc321f23.tar.xz |
ShellPkg: Fix a bug ">>v" cannot append data to environment variable
When ">v" is used to redirect the command output to environment
variable, the ending "\r\n\0" is removed before setting to environment
variable but the length is not updated.
It causes ">>v" fails to append data to the environment variable
created by ">v".
The patch fixes the above bug.
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
-rw-r--r-- | ShellPkg/Application/Shell/FileHandleWrappers.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ShellPkg/Application/Shell/FileHandleWrappers.c b/ShellPkg/Application/Shell/FileHandleWrappers.c index 3c11d82944..0a7a60294d 100644 --- a/ShellPkg/Application/Shell/FileHandleWrappers.c +++ b/ShellPkg/Application/Shell/FileHandleWrappers.c @@ -3,7 +3,7 @@ StdIn, StdOut, StdErr, etc...).
Copyright 2016 Dell Inc.
- Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2013 Hewlett-Packard Development Company, L.P.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -1074,6 +1074,10 @@ FileInterfaceEnvClose( (((CHAR16*)NewBuffer)[TotalSize / sizeof (CHAR16) - 3] == CHAR_CARRIAGE_RETURN)
) {
((CHAR16*)NewBuffer)[TotalSize / sizeof (CHAR16) - 3] = CHAR_NULL;
+ //
+ // If the NewBuffer end with \r\n\0, We will repace '\r' by '\0' and then update TotalSize.
+ //
+ TotalSize -= sizeof(CHAR16) * 2;
}
if (Volatile) {
|