浏览代码

Bug 1999: Failure when SFTP server resolves "." path to an empty string

https://winscp.net/tracker/1999
(cherry picked from commit 5ab9308af08aeaa3cb06d4bc70bc86fabf4726ab)

Source commit: 59f1f053d3fcdd7a9ab271798d845ef0ec62c9a7
Martin Prikryl 4 年之前
父节点
当前提交
0526ba04e9
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      source/core/SftpFileSystem.cpp

+ 5 - 0
source/core/SftpFileSystem.cpp

@@ -2923,6 +2923,11 @@ UnicodeString __fastcall TSFTPFileSystem::GetHomeDirectory()
   if (FHomeDirectory.IsEmpty())
   {
     FHomeDirectory = RealPath(L".");
+    // Prevent infinite recursion when the server is broken
+    if (FHomeDirectory.IsEmpty())
+    {
+      FHomeDirectory = ROOTDIRECTORY;
+    }
   }
   return FHomeDirectory;
 }