[ https://issues.apache.org/jira/browse/SSHD-967?focusedWorklogId=390585&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-390585 ]
ASF GitHub Bot logged work on SSHD-967: --------------------------------------- Author: ASF GitHub Bot Created on: 21/Feb/20 11:40 Start Date: 21/Feb/20 11:40 Worklog Time Spent: 10m Work Description: NitinRanjan commented on pull request #111: [SSHD-967] fixed byte buffer issue URL: https://github.com/apache/mina-sshd/pull/111#discussion_r382537338 ########## 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: Both are same, but to make it understand easily it is better to change it to read. I have tested with read and it working fine. Committed the change to forked branch ---------------------------------------------------------------- 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: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 390585) Time Spent: 50m (was: 40m) > 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 > Assignee: Lyor Goldstein > Priority: Major > Fix For: 2.4.1 > > Time Spent: 50m > 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: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org