浏览代码

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

https://winscp.net/tracker/1999

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

+ 5 - 0
source/core/SftpFileSystem.cpp

@@ -2924,6 +2924,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;
 }