]> asedeno.scripts.mit.edu Git - PuTTY_svn.git/commitdiff
Fix breakage of SSH-2 packet decompression by r10070.
authorSimon Tatham <anakin@pobox.com>
Mon, 2 Dec 2013 19:26:36 +0000 (19:26 +0000)
committerSimon Tatham <anakin@pobox.com>
Mon, 2 Dec 2013 19:26:36 +0000 (19:26 +0000)
The line that resets st->pktin->length to cover only the semantic
payload of the SSH message was overwriting the modification to
st->pktin->length performed by the optional decompression step. I
didn't notice because I don't habitually enable compression.

git-svn-id: http://svn.tartarus.org/sgt/putty@10103 cda61777-01e9-0310-a592-d414129be87e

ssh.c

diff --git a/ssh.c b/ssh.c
index 0f318075a697fb55223d49ad622decf63fb85ab5..8bcb1e8564a10c2eca99fe03661c48116a0594d9 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -1711,6 +1711,9 @@ static struct Packet *ssh2_rdpkt(Ssh ssh, unsigned char **data, int *datalen)
 
     st->pktin->sequence = st->incoming_sequence++;
 
+    st->pktin->length = st->packetlen - st->pad;
+    assert(st->pktin->length >= 0);
+
     /*
      * Decompress packet payload.
      */
@@ -1739,7 +1742,7 @@ static struct Packet *ssh2_rdpkt(Ssh ssh, unsigned char **data, int *datalen)
      */
     st->pktin->type = st->pktin->data[5];
     st->pktin->body = st->pktin->data + 6;
-    st->pktin->length = st->packetlen - 6 - st->pad;
+    st->pktin->length -= 6;
     assert(st->pktin->length >= 0);    /* one last double-check */
 
     if (ssh->logctx)