summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/packet.c
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>1999-11-02 19:42:38 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>1999-11-02 19:42:38 +0000
commit2ead5c3b4ced4f49e06a89584465413410b5ba48 (patch)
tree48e1bb52c0e107927c0f5704e3d56bcddc187f8a /usr.bin/ssh/packet.c
parente0db7ed9032e37a2f0f4b9704101d7745e3b8b4a (diff)
replace assert() with error, fatal or packet_disconnect
Diffstat (limited to 'usr.bin/ssh/packet.c')
-rw-r--r--usr.bin/ssh/packet.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.bin/ssh/packet.c b/usr.bin/ssh/packet.c
index a37a09055e1..66d3595fce4 100644
--- a/usr.bin/ssh/packet.c
+++ b/usr.bin/ssh/packet.c
@@ -15,7 +15,7 @@ with the other side. This same code is used both on client and server side.
*/
#include "includes.h"
-RCSID("$Id: packet.c,v 1.9 1999/10/05 01:23:54 dugsong Exp $");
+RCSID("$Id: packet.c,v 1.10 1999/11/02 19:42:36 markus Exp $");
#include "xmalloc.h"
#include "buffer.h"
@@ -194,7 +194,6 @@ void
packet_encrypt(CipherContext *cc, void *dest, void *src,
unsigned int bytes)
{
- assert((bytes % 8) == 0);
cipher_encrypt(cc, dest, src, bytes);
}
@@ -207,7 +206,8 @@ packet_decrypt(CipherContext *cc, void *dest, void *src,
{
int i;
- assert((bytes % 8) == 0);
+ if ((bytes % 8) != 0)
+ fatal("packet_decrypt: bad ciphertext length %d", bytes);
/*
Cryptographic attack detector for ssh - Modifications for packet.c
@@ -500,7 +500,11 @@ packet_read_poll(int *payload_len_ptr)
buffer_consume(&incoming_packet, 8 - len % 8);
/* Test check bytes. */
- assert(len == buffer_len(&incoming_packet));
+
+ if (len != buffer_len(&incoming_packet))
+ packet_disconnect("packet_read_poll: len %d != buffer_len %d.",
+ len, buffer_len(&incoming_packet));
+
ucp = (unsigned char *)buffer_ptr(&incoming_packet) + len - 4;
stored_checksum = GET_32BIT(ucp);
if (checksum != stored_checksum)