[ 
https://issues.apache.org/jira/browse/SSHD-634?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15130076#comment-15130076
 ] 

Eugene Petrenko commented on SSHD-634:
--------------------------------------

Thanks. I will apply it shortly. Will try to put similar code via inheritance 
to avoid re-building the lib locally

Not sure if I understand the code fully, could you please explain the 
following. why can't one be using 2 buffers of similar size. One to receive a 
raw message from socket, the other one to copy extracted/decrtypted bytes from 
the raw message. So the second buffer is used in the entire code. The same 
logic can also be considered for sending packets. The only cost for that is 2x 
memory consumption, but AFAIK buffers are small. This way will also allow to 
introduce readonly buffers, that are way safe in terms of side effects

> Suspicious read buffer re-use in write command
> ----------------------------------------------
>
>                 Key: SSHD-634
>                 URL: https://issues.apache.org/jira/browse/SSHD-634
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Eugene Petrenko
>            Assignee: Goldstein Lyor
>             Fix For: 1.2.0
>
>
> From time to time I saw a {{Bad packet length ###}} errors from SSH clients 
> that calls commands to the SSHD server running with Apache SSHD. 
> It may turn out there are some issues in the implementation. 
> I found one suspicious usage of buffers around 
> {{org.apache.sshd.common.channel.AbstractChannel#sendResponse}} method. As 
> far as I see from the code it uses the read buffer as a place to generate a 
> write packet command. Maybe it's worth to create a fresh buffer here to avoid 
> it be updated from the other thread while it is put to a write queue



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to