mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-19 19:55:11 +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 = '';
|
$content = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$start = $offset;
|
||||||
$size = $this->max_sftp_packet < $length || $length < 0 ? $this->max_sftp_packet : $length;
|
$size = $this->max_sftp_packet < $length || $length < 0 ? $this->max_sftp_packet : $length;
|
||||||
while (true) {
|
while (true) {
|
||||||
$packet = pack('Na*N3', strlen($handle), $handle, $offset / 4294967296, $offset, $size);
|
$packet = pack('Na*N3', strlen($handle), $handle, $offset / 4294967296, $offset, $size);
|
||||||
@ -1718,12 +1719,12 @@ class Net_SFTP extends Net_SSH2
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($length > 0 && $length <= $offset - $size) {
|
if ($length > 0 && $length <= $offset - $start) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($length > 0 && $length <= $offset - $size) {
|
if ($length > 0 && $length <= $offset - $start) {
|
||||||
if ($local_file === false) {
|
if ($local_file === false) {
|
||||||
$content = substr($content, 0, $length);
|
$content = substr($content, 0, $length);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user