Browse Source

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

https://winscp.net/tracker/1999

Source commit: 94fd20cdddc1f74549c649bb84e4f20a900ca503
Martin Prikryl 4 years ago
parent
commit
5ab9308af0
1 changed files with 5 additions and 0 deletions
  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;
 }