From c20b661a4417cab29965581a5fabc4f42aba3f7d Mon Sep 17 00:00:00 2001 From: terrafrost Date: Thu, 11 Aug 2016 23:09:38 -0500 Subject: [PATCH] SSH2: don't check for carriage return in version id string --- phpseclib/Net/SSH2.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index c5f3d9a4..11580755 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -1058,10 +1058,20 @@ class SSH2 } $line.= "$temp\n"; - if (substr($line, -2) == "\r\n") { - break; - } + + // quoting RFC4253, "Implementers who wish to maintain + // compatibility with older, undocumented versions of this protocol may + // want to process the identification string without expecting the + // presence of the carriage return character for reasons described in + // Section 5 of this document." + + //if (substr($line, -2) == "\r\n") { + // break; + //} + + break; } + $data.= $line; }