aboutsummaryrefslogtreecommitdiff
path: root/crypto/openssh/packet.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/openssh/packet.c')
-rw-r--r--crypto/openssh/packet.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/crypto/openssh/packet.c b/crypto/openssh/packet.c
index a5b2ab61a9c6..bd347ef0f4ff 100644
--- a/crypto/openssh/packet.c
+++ b/crypto/openssh/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);