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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to