- StrCat(DestPath, DestDir+1);\r
- StrCat(DestPath, Node->FileName);\r
- } else if (StrStr(DestDir, L":") == NULL) {\r
- StrCpy(DestPath, Cwd);\r
- if (DestPath[StrLen(DestPath)-1] != L'\\' && DestDir[0] != L'\\') {\r
- StrCat(DestPath, L"\\");\r
- } else if (DestPath[StrLen(DestPath)-1] == L'\\' && DestDir[0] == L'\\') {\r
+ StrnCat(DestPath, CleanFilePathStr+1, PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);\r
+ StrnCat(DestPath, Node->FileName, PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);\r
+ } else if (StrStr(CleanFilePathStr, L":") == NULL) {\r
+ if (Cwd != NULL) {\r
+ StrnCpy(DestPath, Cwd, PathSize/sizeof(CHAR16) -1);\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, L"cp", CleanFilePathStr); \r
+ FreePool(CleanFilePathStr);\r
+ return (SHELL_INVALID_PARAMETER);\r
+ }\r
+ if (DestPath[StrLen(DestPath)-1] != L'\\' && CleanFilePathStr[0] != L'\\') {\r
+ StrnCat(DestPath, L"\\", PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);\r
+ } else if (DestPath[StrLen(DestPath)-1] == L'\\' && CleanFilePathStr[0] == L'\\') {\r