mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-16 02:07:09 +00:00
SSH2: identification strings > 255 bytes didnt get parsed correctly
This commit is contained in:
parent
43af71e538
commit
778035aa71
@ -1361,25 +1361,17 @@ class SSH2
|
|||||||
}
|
}
|
||||||
|
|
||||||
$temp = stream_get_line($this->fsock, 255, "\n");
|
$temp = stream_get_line($this->fsock, 255, "\n");
|
||||||
if (strlen($temp) == 255) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($temp === false) {
|
if ($temp === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$line.= "$temp\n";
|
$line .= $temp;
|
||||||
|
if (strlen($temp) == 255) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// quoting RFC4253, "Implementers who wish to maintain
|
$line .= "\n";
|
||||||
// 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;
|
break;
|
||||||
}
|
}
|
||||||
@ -1400,7 +1392,8 @@ class SSH2
|
|||||||
$this->_append_log('->', $this->identifier . "\r\n");
|
$this->_append_log('->', $this->identifier . "\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->server_identifier = trim($temp, "\r\n");
|
$this->server_identifier = trim($data, "\r\n");
|
||||||
|
|
||||||
if (strlen($extra)) {
|
if (strlen($extra)) {
|
||||||
$this->errors[] = $data;
|
$this->errors[] = $data;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user