summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
diff options
context:
space:
mode:
authorjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-10 17:26:25 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-10 17:26:25 +0000
commitbeab0fc5e2ea7c676968991b1ae8e1fc72aef19f (patch)
tree98408a7c86ab39da411175a2e5ab30d5b04f7377 /ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
parent091bb7138b9b7b18e32f13d415e8fc5f518de8fc (diff)
downloadedk2-platforms-beab0fc5e2ea7c676968991b1ae8e1fc72aef19f.tar.xz
ShellPkg: Verify memory allocations without ASSERT.
signed-off-by: jcarsey reviewed-by: geekboy15a git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12522 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c')
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
index b83eede5a9..a93ef33c03 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
@@ -120,9 +120,10 @@ IsValidMove(
@param[in, out] DestPathPointer A pointer to the callee allocated final path.
@param[in] Cwd A pointer to the current working directory.
- @retval EFI_INVALID_PARAMETR The DestDir could not be resolved to a location.
- @retval EFI_INVALID_PARAMETR The DestDir could be resolved to more than 1 location.
- @retval EFI_SUCCESS The operation was sucessful.
+ @retval SHELL_INVALID_PARAMETER The DestDir could not be resolved to a location.
+ @retval SHELL_INVALID_PARAMETER The DestDir could be resolved to more than 1 location.
+ @retval SHELL_INVALID_PARAMETER Cwd is required and is NULL.
+ @retval SHELL_SUCCESS The operation was sucessful.
**/
SHELL_STATUS
EFIAPI
@@ -143,6 +144,9 @@ GetDestinationLocation(
DestPath = NULL;
if (StrStr(DestDir, L"\\") == DestDir) {
+ if (Cwd == NULL) {
+ return SHELL_INVALID_PARAMETER;
+ }
DestPath = AllocateZeroPool(StrSize(Cwd));
if (DestPath == NULL) {
return (SHELL_OUT_OF_RESOURCES);
@@ -161,6 +165,10 @@ GetDestinationLocation(
// Not existing... must be renaming
//
if ((TempLocation = StrStr(DestDir, L":")) == NULL) {
+ if (Cwd == NULL) {
+ ShellCloseFileMetaArg(&DestList);
+ return (SHELL_INVALID_PARAMETER);
+ }
NewSize = StrSize(Cwd);
NewSize += StrSize(DestDir);
DestPath = AllocateZeroPool(NewSize);