[ 
https://issues.apache.org/jira/browse/SSHD-629?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eugene Petrenko updated SSHD-629:
---------------------------------
    Affects Version/s: 1.0.0

> java.lang.IllegalStateException: Bad item length: 89430
> -------------------------------------------------------
>
>                 Key: SSHD-629
>                 URL: https://issues.apache.org/jira/browse/SSHD-629
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Eugene Petrenko
>
> I updated default properties of the server to set default packet length to be 
> 4mb. Via code like that
> ```
>       mySSHD.getProperties().put(FactoryManager.MAX_PACKET_SIZE, 4 * MB);
> ```
> Next we connected it to jsch ssh client, that was able to increase send 
> buffer size beyond 64kb limit. This makes an assert in AbstractChannel.java 
> to fail.
> From the code I see the buffer size is compared to ByteArrayBuffer.MAX_LEN 
> which is 64k.
> ```
>         int len = buffer.getInt();
>         if (len < 0 || len > ByteArrayBuffer.MAX_LEN) {
>             throw new IllegalStateException("Bad item length: " + len);
>         }
> ```
> Actual exception I received in my code was
> ```java.lang.IllegalStateException: Bad item length: 89430
>     at 
> org.apache.sshd.common.channel.AbstractChannel.handleData(AbstractChannel.java:314)
>     at 
> org.apache.sshd.common.session.AbstractConnectionService.channelData(AbstractConnectionService.java:262)
>     at 
> org.apache.sshd.common.session.AbstractConnectionService.process(AbstractConnectionService.java:197)
>     at 
> org.apache.sshd.common.session.AbstractSession.doHandleMessage(AbstractSession.java:401)
>     at 
> org.apache.sshd.common.session.AbstractSession.handleMessage(AbstractSession.java:349)
>     at 
> org.apache.sshd.common.session.AbstractSession.decode(AbstractSession.java:848)
>     at 
> org.apache.sshd.common.session.AbstractSession.messageReceived(AbstractSession.java:331)
>  <...>
>  ```
> Let's either deny setting packet size too bit or allow it to be used in the 
> code



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

Reply via email to