[
https://issues.apache.org/jira/browse/SSHD-967?focusedWorklogId=390573&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-390573
]
ASF GitHub Bot logged work on SSHD-967:
---------------------------------------
Author: ASF GitHub Bot
Created on: 21/Feb/20 10:56
Start Date: 21/Feb/20 10:56
Worklog Time Spent: 10m
Work Description: lgoldstein commented on pull request #111: [SSHD-967]
fixed byte buffer issue
URL: https://github.com/apache/mina-sshd/pull/111#discussion_r382520189
##########
File path:
sshd-sftp/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpRemotePathChannel.java
##########
@@ -262,7 +262,7 @@ public long transferTo(long position, long count,
WritableByteChannel target) th
while (totalRead < count) {
int read = sftp.read(handle, curPos, buffer, 0,
buffer.length);
if (read > 0) {
- ByteBuffer wrap = ByteBuffer.wrap(buffer);
+ ByteBuffer wrap = ByteBuffer.wrap(buffer, 0, (int)
Math.min(count - totalRead, buffer.length));
Review comment:
Shouldn't this be ?
```java
ByteBuffer wrap = ByteBuffer.wrap(buffer, 0, read);
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 390573)
Time Spent: 20m (was: 10m)
> transferTo function of SftpRemotePathChannel always add some extra bytes in
> the end of file
> -------------------------------------------------------------------------------------------
>
> Key: SSHD-967
> URL: https://issues.apache.org/jira/browse/SSHD-967
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 2.0.0
> Reporter: Nitin Ranjan
> Priority: Major
> Fix For: 2.4.1
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> transferTo function of SftpRemotePathChannel always add some extra bytes in
> the end of file
>
> I have tried to transfer gz file from sftp server after transfer when I tried
> to decompress it it was giving warning
> *decompression ok trailing garbage ignored*
>
> When I checked the file I found some extra bytes appended to the file
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]