java.lang.ArrayIndexOutOfBoundsException

Tom Deckers tom_deckers@hotmail.com
Wed, 02 Jul 2003 23:19:44 +0200


All,

Not sure where bugs are supposed to be reported, but I've been struggling 
with following issue.  And the good news: fix included!

I got following exception while running a small example:

java.lang.ArrayIndexOutOfBoundsException
	at com.mindbright.ssh2.SSH2ListUtil.arrayFromList(SSH2ListUtil.java:128)
	at com.mindbright.ssh2.SSH2ListUtil.chooseFromList(SSH2ListUtil.java:25)
	at com.mindbright.ssh2.SSH2Preferences.choosePref(SSH2Preferences.java:428)
	at com.mindbright.ssh2.SSH2Preferences.canAgree(SSH2Preferences.java:391)
	at 
com.mindbright.ssh2.SSH2Transport.processKEXINIT(SSH2Transport.java:1168)
	at 
com.mindbright.ssh2.SSH2Transport.processRxPacket(SSH2Transport.java:1435)
	at 
com.mindbright.ssh2.SSH2Transport.transportReceiveLoop(SSH2Transport.java:1346)
	at com.mindbright.ssh2.SSH2Transport.access$1(SSH2Transport.java:1339)
	at com.mindbright.ssh2.SSH2Transport$2.run(SSH2Transport.java:362)
	at java.lang.Thread.run(Thread.java:479)

Reason:

SSH2ListUtil.arrayFromList(String) - line 125:

A String array is created of size 32.  My server returns a list of supported 
ciphers with more than 32 choices:

aes128-cbc,3des-cbc,blowfish-cbc,twofish128-cbc,twofish-cbc,arcfour,cast128-cbc,aes192-cbc,aes256-cbc,twofish192-cbc,twofish256-cbc,3des-ecb,3des-cfb,3des-ofb,blowfish-ecb,blowfish-cfb,blowfish-ofb,des-ecb,des-cbc,des-cfb,des-ofb,cast128-ecb,cast128-cfb,cast128-ofb,cast128-12-ecb,cast128-12-cbc,cast128-12-cfb,cast128-12-ofb,rc2-ecb,rc2-cbc,rc2-cfb,rc2-ofb,rc2-128-ecb,rc2-128-cbc,rc2-128-cfb,rc2-128-ofb


Fix:

Create String array of 64 ;-) Of course a check for array size etc, would be 
nice too.

Regards,
Tom.

_________________________________________________________________