diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2011-06-11 10:51:38 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-06-11 13:16:21 +0200 |
commit | ccc94e7ab62d1a9fb1468a3fa276b12cd9a973ca (patch) | |
tree | de1501a8a618fcaf1dae3612588ae354b6fe7172 /src | |
parent | 4c05be0c1b2d02b17665e28f2a7b54dd49e14b92 (diff) | |
download | libssh-ccc94e7ab62d1a9fb1468a3fa276b12cd9a973ca.tar.gz libssh-ccc94e7ab62d1a9fb1468a3fa276b12cd9a973ca.tar.xz libssh-ccc94e7ab62d1a9fb1468a3fa276b12cd9a973ca.zip |
packet: Don't (de)compress empty buffers.
This fixes bug #50.
(cherry picked from commit fb0f1253519d5ff76fac1f0fc84077541ca93033)
Diffstat (limited to 'src')
-rw-r--r-- | src/packet.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/packet.c b/src/packet.c index 52e1ef01..543c50dc 100644 --- a/src/packet.c +++ b/src/packet.c @@ -255,7 +255,9 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user) "After padding, %d bytes left in buffer", buffer_get_rest_len(session->in_buffer)); #if defined(HAVE_LIBZ) && defined(WITH_LIBZ) - if (session->current_crypto && session->current_crypto->do_compress_in) { + if (session->current_crypto + && session->current_crypto->do_compress_in + && buffer_get_rest_len(session->in_buffer)) { ssh_log(session, SSH_LOG_PACKET, "Decompressing in_buffer ..."); if (decompress_buffer(session, session->in_buffer,MAX_PACKET_LEN) < 0) { goto error; @@ -457,7 +459,9 @@ static int packet_send2(ssh_session session) { "Writing on the wire a packet having %u bytes before", currentlen); #if defined(HAVE_LIBZ) && defined(WITH_LIBZ) - if (session->current_crypto && session->current_crypto->do_compress_out) { + if (session->current_crypto + && session->current_crypto->do_compress_out + && buffer_get_rest_len(session->out_buffer)) { ssh_log(session, SSH_LOG_PACKET, "Compressing out_buffer ..."); if (compress_buffer(session,session->out_buffer) < 0) { goto error; |