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>
This commit is contained in:
parent
dd6d0a520e
commit
5016d46603
|
@ -3,7 +3,7 @@
|
||||||
StdIn, StdOut, StdErr, etc...).
|
StdIn, StdOut, StdErr, etc...).
|
||||||
|
|
||||||
Copyright 2016 Dell Inc.
|
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>
|
(C) Copyright 2013 Hewlett-Packard Development Company, L.P.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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_CARRIAGE_RETURN)
|
||||||
) {
|
) {
|
||||||
((CHAR16*)NewBuffer)[TotalSize / sizeof (CHAR16) - 3] = CHAR_NULL;
|
((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) {
|
if (Volatile) {
|
||||||
|
|
Loading…
Reference in New Issue