comparison src/ch/ethz/ssh2/transport/TransportConnection.java @ 372:20d0a1356c43

debug kex error
author Carl Byington <carl@five-ten-sg.com>
date Mon, 04 Aug 2014 12:11:12 -0700
parents 071eccdff8ea
children
comparison
equal deleted inserted replaced
371:071a1ff9b6bf 372:20d0a1356c43
229 if (recv_packet_header_present == false) { 229 if (recv_packet_header_present == false) {
230 cis.read(recv_packet_header_buffer, 0, 5); 230 cis.read(recv_packet_header_buffer, 0, 5);
231 recv_packet_header_present = true; 231 recv_packet_header_present = true;
232 } 232 }
233 233
234 int packet_length = ((recv_packet_header_buffer[0] & 0xff) << 24) 234 int packet_length = ((recv_packet_header_buffer[0] & 0xff) << 24) |
235 | ((recv_packet_header_buffer[1] & 0xff) << 16) | ((recv_packet_header_buffer[2] & 0xff) << 8) 235 ((recv_packet_header_buffer[1] & 0xff) << 16) |
236 | ((recv_packet_header_buffer[3] & 0xff)); 236 ((recv_packet_header_buffer[2] & 0xff) << 8) |
237 ((recv_packet_header_buffer[3] & 0xff));
237 int padding_length = recv_packet_header_buffer[4] & 0xff; 238 int padding_length = recv_packet_header_buffer[4] & 0xff;
238 239
239 if (packet_length > TransportManager.MAX_PACKET_SIZE || packet_length < 12) { 240 if (packet_length > TransportManager.MAX_PACKET_SIZE || packet_length < 12) {
240 throw new PacketFormatException(String.format("Illegal packet size (%d)", packet_length)); 241 throw new PacketFormatException(String.format("Illegal packet size (%d)", packet_length));
241 } 242 }
255 } 256 }
256 else { 257 else {
257 recv_packet_header_present = false; 258 recv_packet_header_present = false;
258 } 259 }
259 260
260 int packet_length = ((recv_packet_header_buffer[0] & 0xff) << 24) 261 int packet_length = ((recv_packet_header_buffer[0] & 0xff) << 24) |
261 | ((recv_packet_header_buffer[1] & 0xff) << 16) | ((recv_packet_header_buffer[2] & 0xff) << 8) 262 ((recv_packet_header_buffer[1] & 0xff) << 16) |
262 | ((recv_packet_header_buffer[3] & 0xff)); 263 ((recv_packet_header_buffer[2] & 0xff) << 8) |
264 ((recv_packet_header_buffer[3] & 0xff));
263 int padding_length = recv_packet_header_buffer[4] & 0xff; 265 int padding_length = recv_packet_header_buffer[4] & 0xff;
264 266
265 if (packet_length > TransportManager.MAX_PACKET_SIZE || packet_length < 12) { 267 if (packet_length > TransportManager.MAX_PACKET_SIZE || packet_length < 12) {
266 throw new PacketFormatException(String.format("Illegal packet size (%d)", packet_length)); 268 throw new PacketFormatException(String.format("Illegal packet size (%d)", packet_length));
267 } 269 }