You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Goldstein Lyor (JIRA)" <ji...@apache.org> on 2016/01/27 13:31:39 UTC
[jira] [Resolved] (SSHD-629) Use consistent max. packet size
configuration throughout the code
[ https://issues.apache.org/jira/browse/SSHD-629?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Goldstein Lyor resolved SSHD-629.
---------------------------------
Resolution: Fixed
Fix Version/s: 1.2.0
> Use consistent max. packet size configuration throughout the code
> -----------------------------------------------------------------
>
> 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
> Assignee: Goldstein Lyor
> Fix For: 1.2.0
>
>
> 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)