diff options
Diffstat (limited to 'ShellPkg')
-rw-r--r-- | ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c index d02a6ae5f5..f93772c6f8 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c @@ -736,11 +736,15 @@ ShellCommandRunMv ( //
CwdSize = StrSize(ShellGetCurrentDir(NULL)) + sizeof(CHAR16);
Cwd = AllocateZeroPool(CwdSize);
- ASSERT (Cwd != NULL);
- StrCpyS(Cwd, CwdSize/sizeof(CHAR16), ShellGetCurrentDir(NULL));
- StrCatS(Cwd, CwdSize/sizeof(CHAR16), L"\\");
- ShellStatus = ValidateAndMoveFiles(FileList, &Response, Cwd);
- FreePool(Cwd);
+ if (Cwd == NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellLevel2HiiHandle, L"mv");
+ ShellStatus = SHELL_OUT_OF_RESOURCES;
+ } else {
+ StrCpyS (Cwd, CwdSize / sizeof (CHAR16), ShellGetCurrentDir (NULL));
+ StrCatS (Cwd, CwdSize / sizeof (CHAR16), L"\\");
+ ShellStatus = ValidateAndMoveFiles (FileList, &Response, Cwd);
+ FreePool (Cwd);
+ }
}
}
|