From ad88325b3fb61761806a583fc7480327461de1a0 Mon Sep 17 00:00:00 2001 From: Alfred Gebert Date: Wed, 16 Feb 2011 13:56:05 +0100 Subject: [PATCH] fullpacket: decompression only after init The buffer for the decompression (remote.comp_abstract) is initialised in time when it is needed. With this fix decompression is disabled when the buffer (remote.comp_abstract) is not initialised. Bug: http://trac.libssh2.org/ticket/200 --- src/transport.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/transport.c b/src/transport.c index 38e005a..5651f3a 100644 --- a/src/transport.c +++ b/src/transport.c @@ -199,7 +199,15 @@ fullpacket(LIBSSH2_SESSION * session, int encrypted /* 1 or 0 */ ) session->fullpacket_payload_len -= p->padding_length; /* Check for and deal with decompression */ - if (session->remote.comp && session->remote.comp->compress) { + if (session->remote.comp && + session->remote.comp->compress && + session->remote.comp_abstract) { + /* + * The buffer for the decompression (remote.comp_abstract) is + * initialised in time when it is needed so as long it is NULL we + * cannot decompress. + */ + unsigned char *data; size_t data_len; rc = session->remote.comp->decomp(session,