From f216b363288d19bd5a6b5ee6078cc3b806968a95 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 10 Aug 2007 22:22:45 +0000 Subject: [PATCH] When we have less than blocksize data left we MUST (attempt to) read more since we can't decrypt anything in that situation. --- src/transport.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/transport.c b/src/transport.c index bc83f7c..ab128d5 100644 --- a/src/transport.c +++ b/src/transport.c @@ -267,7 +267,6 @@ libssh2_packet_read(LIBSSH2_SESSION * session) int numdecrypt; unsigned char block[MAX_BLOCKSIZE]; int blocksize; - int minimum; int encrypted = 1; /* @@ -293,7 +292,6 @@ libssh2_packet_read(LIBSSH2_SESSION * session) blocksize = 5; /* not strictly true, but we can use 5 here to make the checks below work fine still */ } - minimum = p->total_num ? p->total_num - p->data_num : blocksize; /* read/use a whole big chunk into a temporary area stored in the LIBSSH2_SESSION struct. We will decrypt data from that @@ -308,8 +306,8 @@ libssh2_packet_read(LIBSSH2_SESSION * session) /* if remainbuf turns negative we have a bad internal error */ assert(remainbuf >= 0); - if (remainbuf < minimum) { - /* If we have less than a minimum left, it is too + if (remainbuf < blocksize) { + /* If we have less than a blocksize left, it is too little data to deal with, read more */ ssize_t nread;