mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-29 04:23:34 +00:00
Merge branch 'master' into php5
* master: SFTP: make get() return correctly sized strings
This commit is contained in:
commit
d48e284cae
@ -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