You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Eugene Petrenko (JIRA)" <ji...@apache.org> on 2016/01/25 10:46:39 UTC
[jira] [Created] (SSHD-629) java.lang.IllegalStateException: Bad
item length: 89430
Eugene Petrenko created SSHD-629:
------------------------------------
Summary: 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
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)