Browse Source

Bug 1963: Hang after receiving multiline response from FTP server

https://winscp.net/tracker/1963

+ fixing typo in a field name

Source commit: 63f47d904b3727228423d3414e4cd4ac6b578df8
Martin Prikryl 4 years ago
parent
commit
2cd87da319
2 changed files with 8 additions and 7 deletions
  1. 7 6
      source/core/FtpFileSystem.cpp
  2. 1 1
      source/core/FtpFileSystem.h

+ 7 - 6
source/core/FtpFileSystem.cpp

@@ -331,7 +331,7 @@ void __fastcall TFTPFileSystem::Open()
 
   FLastDataSent = Now();
 
-  FMultineResponse = false;
+  FMultiLineResponse = false;
 
   // initialize FZAPI on the first connect only
   if (FFileZillaIntf == NULL)
@@ -3039,6 +3039,7 @@ void __fastcall TFTPFileSystem::ResetReply()
 {
   FLastCode = 0;
   FLastCodeClass = 0;
+  FMultiLineResponse = false;
   DebugAssert(FLastResponse != NULL);
   FLastResponse->Clear();
   DebugAssert(FLastErrorResponse != NULL);
@@ -3345,9 +3346,9 @@ void __fastcall TFTPFileSystem::HandleReplyStatus(UnicodeString Response)
     (Code >= 100) && (Code <= 599) &&
     ((Response.Length() == 3) || (Response[4] == L' ') || (Response[4] == L'-'));
 
-  if (HasCodePrefix && !FMultineResponse)
+  if (HasCodePrefix && !FMultiLineResponse)
   {
-    FMultineResponse = (Response.Length() >= 4) && (Response[4] == L'-');
+    FMultiLineResponse = (Response.Length() >= 4) && (Response[4] == L'-');
     FLastResponse->Clear();
     FLastErrorResponse->Clear();
     SetLastCode(Code);
@@ -3365,7 +3366,7 @@ void __fastcall TFTPFileSystem::HandleReplyStatus(UnicodeString Response)
       // End of multiline response?
       if ((Response.Length() <= 3) || (Response[4] == L' '))
       {
-        FMultineResponse = false;
+        FMultiLineResponse = false;
       }
       Start = 5;
     }
@@ -3375,7 +3376,7 @@ void __fastcall TFTPFileSystem::HandleReplyStatus(UnicodeString Response)
     }
 
     // Intermediate empty lines are being added
-    if (FMultineResponse || (Response.Length() >= Start))
+    if (FMultiLineResponse || (Response.Length() >= Start))
     {
       StoreLastResponse(Response.SubString(Start, Response.Length() - Start + 1));
     }
@@ -3395,7 +3396,7 @@ void __fastcall TFTPFileSystem::HandleReplyStatus(UnicodeString Response)
     }
   }
 
-  if (!FMultineResponse)
+  if (!FMultiLineResponse)
   {
     if (FLastCode == 220)
     {

+ 1 - 1
source/core/FtpFileSystem.h

@@ -240,7 +240,7 @@ private:
   TCommand FLastCommand;
   bool FPasswordFailed;
   bool FStoredPasswordTried;
-  bool FMultineResponse;
+  bool FMultiLineResponse;
   int FLastCode;
   int FLastCodeClass;
   int FLastReadDirectoryProgress;