summaryrefslogtreecommitdiff
path: root/packet.c
diff options
context:
space:
mode:
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/packet.c b/packet.c
index 7e74c73b3..6dfd492a1 100644
--- a/packet.c
+++ b/packet.c
@@ -15,7 +15,7 @@ with the other side. This same code is used both on client and server side.
15*/ 15*/
16 16
17#include "includes.h" 17#include "includes.h"
18RCSID("$Id: packet.c,v 1.1 1999/10/27 03:42:44 damien Exp $"); 18RCSID("$Id: packet.c,v 1.2 1999/11/08 05:15:55 damien Exp $");
19 19
20#include "xmalloc.h" 20#include "xmalloc.h"
21#include "buffer.h" 21#include "buffer.h"
@@ -194,7 +194,6 @@ void
194packet_encrypt(CipherContext *cc, void *dest, void *src, 194packet_encrypt(CipherContext *cc, void *dest, void *src,
195 unsigned int bytes) 195 unsigned int bytes)
196{ 196{
197 assert((bytes % 8) == 0);
198 cipher_encrypt(cc, dest, src, bytes); 197 cipher_encrypt(cc, dest, src, bytes);
199} 198}
200 199
@@ -207,7 +206,8 @@ packet_decrypt(CipherContext *cc, void *dest, void *src,
207{ 206{
208 int i; 207 int i;
209 208
210 assert((bytes % 8) == 0); 209 if ((bytes % 8) != 0)
210 fatal("packet_decrypt: bad ciphertext length %d", bytes);
211 211
212 /* 212 /*
213 Cryptographic attack detector for ssh - Modifications for packet.c 213 Cryptographic attack detector for ssh - Modifications for packet.c
@@ -500,7 +500,11 @@ packet_read_poll(int *payload_len_ptr)
500 buffer_consume(&incoming_packet, 8 - len % 8); 500 buffer_consume(&incoming_packet, 8 - len % 8);
501 501
502 /* Test check bytes. */ 502 /* Test check bytes. */
503 assert(len == buffer_len(&incoming_packet)); 503
504 if (len != buffer_len(&incoming_packet))
505 packet_disconnect("packet_read_poll: len %d != buffer_len %d.",
506 len, buffer_len(&incoming_packet));
507
504 ucp = (unsigned char *)buffer_ptr(&incoming_packet) + len - 4; 508 ucp = (unsigned char *)buffer_ptr(&incoming_packet) + len - 4;
505 stored_checksum = GET_32BIT(ucp); 509 stored_checksum = GET_32BIT(ucp);
506 if (checksum != stored_checksum) 510 if (checksum != stored_checksum)