mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-27 03:42:40 +00:00
Merge pull request #237 from terrafrost/sftp-get-size-fix
SFTP: make get() return correctly sized strings * terrafrost/sftp-get-size-fix: SFTP: make get() return correctly sized strings
This commit is contained in:
commit
b82478b48f
@ -1685,6 +1685,7 @@ class Net_SFTP extends Net_SSH2
|
||||
$content = '';
|
||||
}
|
||||
|
||||
$start = $offset;
|
||||
$size = $this->max_sftp_packet < $length || $length < 0 ? $this->max_sftp_packet : $length;
|
||||
while (true) {
|
||||
$packet = pack('Na*N3', strlen($handle), $handle, $offset / 4294967296, $offset, $size);
|
||||
@ -1718,12 +1719,12 @@ class Net_SFTP extends Net_SSH2
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($length > 0 && $length <= $offset - $size) {
|
||||
if ($length > 0 && $length <= $offset - $start) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($length > 0 && $length <= $offset - $size) {
|
||||
if ($length > 0 && $length <= $offset - $start) {
|
||||
if ($local_file === false) {
|
||||
$content = substr($content, 0, $length);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user