Pārlūkot izejas kodu

Bug 2167: Hang when FTP directory listing contains nul character

https://winscp.net/tracker/2167

Source commit: 9f23cc67aa0095a0e5602756620a5f4309befd71
Martin Prikryl 2 gadi atpakaļ
vecāks
revīzija
033f45fcdc
1 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  1. 4 1
      source/filezilla/FtpListResult.cpp

+ 4 - 1
source/filezilla/FtpListResult.cpp

@@ -318,7 +318,10 @@ BOOL CFtpListResult::parseLine(const char *lineToParse, const int linelen, t_dir
 
 bool CFtpListResult::IsNewLineChar(char C) const
 {
-  return (C == '\r') || (C == '\n');
+  return
+    (C == '\r') || (C == '\n') ||
+    // Some of the parsing code cannot handle null characters, so if a malformed server sends some, treat is as a newline
+    (C == '\0');
 }
 
 void CFtpListResult::AddData(const char * Data, int Size)