summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQiu Shumin <shumin.qiu@intel.com>2016-01-06 07:40:56 +0000
committerHao Wu <hao.a.wu@intel.com>2016-07-13 20:41:07 +0800
commitf181897c86a095b0e3c7fabac15b61d404a0104a (patch)
tree2d685129dc7203180732b16a818d48ca323098e0
parent6ee5c88bc57adeb33c242290d4ba6e8894c1cc4c (diff)
downloadedk2-platforms-f181897c86a095b0e3c7fabac15b61d404a0104a.tar.xz
ShellPkg: Fix Shell assert when mv a file to a NULL target.
When run command 'mv file ' the Shell assert. The patch refined the length of the buffer to fix this bug. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin <shumin.qiu@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19607 6f19259b-4bc3-4df7-8a09-765794883524 (cherry picked from commit 10e547ac2d4cf41df2cef1a7ac5ae45184e57d17)
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
index eb7287e48a..29efb1c6fe 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
@@ -2,7 +2,7 @@
Main file for mv shell level 2 function.
(C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>
- Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
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
@@ -731,7 +731,7 @@ ShellCommandRunMv (
//
// ValidateAndMoveFiles will report errors to the screen itself
//
- CwdSize = StrSize(ShellGetCurrentDir(NULL)) + 1;
+ CwdSize = StrSize(ShellGetCurrentDir(NULL)) + sizeof(CHAR16);
Cwd = AllocateZeroPool(CwdSize);
ASSERT (Cwd != NULL);
StrCpyS(Cwd, CwdSize/sizeof(CHAR16), ShellGetCurrentDir(NULL));