You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by GitBox <gi...@apache.org> on 2020/02/21 11:40:36 UTC

[GitHub] [mina-sshd] NitinRanjan commented on a change in pull request #111: [SSHD-967] fixed byte buffer issue

NitinRanjan commented on a change in 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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org