summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
diff options
context:
space:
mode:
authorjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2010-10-04 16:44:57 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2010-10-04 16:44:57 +0000
commit3e082d58262da4108a3f1f2ee8fa0a9441bb2a9b (patch)
treec1ba56013a00d119763ba7c71ed1ab7472e574cf /ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
parent9ea69f8a05b808b4bab81b608436a02e2f2fba09 (diff)
downloadedk2-platforms-3e082d58262da4108a3f1f2ee8fa0a9441bb2a9b.tar.xz
Verify more memory allocations.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10910 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c')
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
index a628781757..7530289a52 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
@@ -44,7 +44,7 @@ IsValidMove(
CHAR16 *Test;
CHAR16 *Test1;
CHAR16 *TestWalker;
- UINTN Result;
+ INTN Result;
UINTN TempLen;
if (Cwd != NULL && StrCmp(FullName, Cwd) == 0) {
//
@@ -236,6 +236,7 @@ ValidateAndMoveFiles(
EFI_FILE_INFO *NewFileInfo;
CHAR16 *TempLocation;
UINTN NewSize;
+ UINTN Length;
ASSERT(FileList != NULL);
ASSERT(DestDir != NULL);
@@ -310,12 +311,16 @@ ValidateAndMoveFiles(
} else {
StrCpy(NewFileInfo->FileName, DestPath);
}
- if (NewFileInfo->FileName[StrLen(NewFileInfo->FileName)-1] == L'\\') {
+ Length = StrLen(NewFileInfo->FileName);
+ if (Length > 0) {
+ Length--;
+ }
+ if (NewFileInfo->FileName[Length] == L'\\') {
if (Node->FileName[0] == L'\\') {
//
// Don't allow for double slashes. Eliminate one of them.
//
- NewFileInfo->FileName[StrLen(NewFileInfo->FileName)-1] = CHAR_NULL;
+ NewFileInfo->FileName[Length] = CHAR_NULL;
}
StrCat(NewFileInfo->FileName, Node->FileName);
}