Hi,
Thank you for your feedback.
+-From: "Stote, John (RBC Dexia IS)" <[EMAIL PROTECTED]> --
|_Date: Tue, 27 Nov 2007 14:14:12 +1100 __
|
|Since the buffer to accommodate the data returned is allocated according
|to the size of the returned data I felt it safe to change the code as
|follows:
|In the code for "public Buffer read(Buffer buf) throws Exception{" :
|...
| // RFC 4253 6.1. Maximum Packet Length
| if(j<5){ // JMS || j>(32768-4)){
| throw new IOException("invalid data");
| }
| j=j+4-s2ccipher_size;
|...
|You can see that I removed the test j>(32768-4) from the if statement.
|This was the only change I needed to make to fix my problem.
Accroding to RFC 4253[1], 6.1. Maximum Packet Length,
"Implementations SHOULD
support longer packets, where they might be needed. For example, if
an implementation wants to send a very large number of certificates,
the larger packets MAY be sent if the identification string indicates
that the other party is able to process them. However,
implementations SHOULD check that the packet length is reasonable in
order for the implementation to avoid denial of service and/or buffer
overflow attacks."
So, the current implementation is not best.
It seems OpenSSH's ssh has done the following check,
if (packet_length < 1 + 4 || packet_length > 256 * 1024) {
packet_disconnect("Bad packet length %u.", packet_length);
}
I'll use 256*1024 instead of 32768 in the next release.
Sincerely,
--
Atsuhiko Yamanaka
JCraft,Inc.
1-14-20 HONCHO AOBA-KU,
SENDAI, MIYAGI 980-0014 Japan.
Tel +81-22-723-2150
+1-415-578-3454
Fax +81-22-224-8773
Skype callto://jcraft/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users