From 030b670e2a6b243453667e91356d637cd0cb3ad5 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 8 Nov 2007 13:51:23 +0000 Subject: [PATCH] Moved the check that the amount of data is larger than the blocksize to only get done on the first block. Based on the bug report #1826989 https://sourceforge.net/tracker/?func=detail&atid=703942&aid=1826989&group_id=125852 --- src/transport.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/transport.c b/src/transport.c index e105541..13f5130 100644 --- a/src/transport.c +++ b/src/transport.c @@ -367,16 +367,19 @@ libssh2_packet_read(LIBSSH2_SESSION * session) /* how much data to deal with from the buffer */ numbytes = remainbuf; - if (numbytes < blocksize) { - /* we can't act on anything less than blocksize */ - return PACKET_EAGAIN; - } - if (!p->total_num) { /* No payload package area allocated yet. To know the size of this payload, we need to decrypt the first blocksize data. */ + if (numbytes < blocksize) { + /* we can't act on anything less than blocksize, but this + check is only done for the initial block since once we have + got the start of a block we can in fact deal with fractions + */ + return PACKET_EAGAIN; + } + if (encrypted) { rc = decrypt(session, &p->buf[p->readidx], block, blocksize); if (rc != PACKET_NONE) {