From 8b2eecdf9f6769520e2601d5de58991d5810873d Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Sun, 7 Jul 2002 22:11:51 +0000 Subject: - deraadt@cvs.openbsd.org 2002/07/04 08:12:15 [channels.c packet.c] blah blah minor nothing as i read and re-read and re-read... --- packet.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'packet.c') diff --git a/packet.c b/packet.c index a5b2ab61a..bd347ef0f 100644 --- a/packet.c +++ b/packet.c @@ -37,7 +37,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: packet.c,v 1.96 2002/06/23 21:10:02 deraadt Exp $"); +RCSID("$OpenBSD: packet.c,v 1.97 2002/07/04 08:12:15 deraadt Exp $"); #include "xmalloc.h" #include "buffer.h" @@ -134,6 +134,7 @@ void packet_set_connection(int fd_in, int fd_out) { Cipher *none = cipher_by_name("none"); + if (none == NULL) fatal("packet_set_connection: cannot load cipher 'none'"); connection_in = fd_in; @@ -402,6 +403,7 @@ packet_set_encryption_key(const u_char *key, u_int keylen, int number) { Cipher *cipher = cipher_by_number(number); + if (cipher == NULL) fatal("packet_set_encryption_key: unknown cipher number %d", number); if (keylen < 20) @@ -443,6 +445,7 @@ void packet_put_char(int value) { char ch = value; + buffer_append(&outgoing_packet, &ch, 1); } void @@ -994,7 +997,8 @@ packet_read_poll2(u_int32_t *seqnr_p) buffer_clear(&incoming_packet); buffer_append(&incoming_packet, buffer_ptr(&compression_buffer), buffer_len(&compression_buffer)); - DBG(debug("input: len after de-compress %d", buffer_len(&incoming_packet))); + DBG(debug("input: len after de-compress %d", + buffer_len(&incoming_packet))); } /* * get packet type, implies consume. @@ -1102,6 +1106,7 @@ u_int packet_get_char(void) { char ch; + buffer_get(&incoming_packet, &ch, 1); return (u_char) ch; } @@ -1135,6 +1140,7 @@ void * packet_get_raw(int *length_ptr) { int bytes = buffer_len(&incoming_packet); + if (length_ptr != NULL) *length_ptr = bytes; return buffer_ptr(&incoming_packet); @@ -1207,6 +1213,7 @@ packet_disconnect(const char *fmt,...) char buf[1024]; va_list args; static int disconnecting = 0; + if (disconnecting) /* Guard against recursive invocations. */ fatal("packet_disconnect called recursively."); disconnecting = 1; @@ -1249,6 +1256,7 @@ void packet_write_poll(void) { int len = buffer_len(&output); + if (len > 0) { len = write(connection_out, buffer_ptr(&output), len); if (len <= 0) { @@ -1368,6 +1376,7 @@ int packet_set_maxsize(int s) { static int called = 0; + if (called) { log("packet_set_maxsize: called twice: old %d new %d", max_packet_size, s); -- cgit v1.2.3