]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: Fix Shell assert when mv a file to a NULL target.
authorQiu Shumin <shumin.qiu@intel.com>
Wed, 6 Jan 2016 07:40:56 +0000 (07:40 +0000)
committershenshushi <shenshushi@Edk2>
Wed, 6 Jan 2016 07:40:56 +0000 (07:40 +0000)
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

ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c

index eb7287e48a38c6c67ab9f2192d3c29595d17b6b5..29efb1c6fe0f0cbce7c57cc68535f24b379e813a 100644 (file)
@@ -2,7 +2,7 @@
   Main file for mv shell level 2 function.\r
 \r
   (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>\r
-  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -731,7 +731,7 @@ ShellCommandRunMv (
             //\r
             // ValidateAndMoveFiles will report errors to the screen itself\r
             //\r
-            CwdSize = StrSize(ShellGetCurrentDir(NULL)) + 1;\r
+            CwdSize = StrSize(ShellGetCurrentDir(NULL)) + sizeof(CHAR16);\r
             Cwd = AllocateZeroPool(CwdSize);\r
             ASSERT (Cwd != NULL);\r
             StrCpyS(Cwd, CwdSize/sizeof(CHAR16), ShellGetCurrentDir(NULL));\r