]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - sshzlib.c
Set the 'must_close_session' flag at the end of close_session(), so
[PuTTY.git] / sshzlib.c
index 373c77930d7a9ceeddb1ce6969011de9324f4e2a..cc2872405d38ef26fa933d5ccbc48b59eafa01c4 100644 (file)
--- a/sshzlib.c
+++ b/sshzlib.c
@@ -224,6 +224,7 @@ static void lz77_compress(struct LZ77Context *ctx,
     }
     st->npending -= i;
 
+    defermatch.distance = 0; /* appease compiler */
     defermatch.len = 0;
     deferchr = '\0';
     while (len > 0) {
@@ -698,9 +699,9 @@ int zlib_compress_block(void *handle, unsigned char *block, int len,
 
            /*
             * Start a Deflate (RFC1951) uncompressed block. We
-            * transmit a zero bit (BFINAL=0), followed by a zero
-            * bit and a one bit (BTYPE=00). Of course these are in
-            * the wrong order (00 0).
+            * transmit a zero bit (BFINAL=0), followed by two more
+            * zero bits (BTYPE=00). Of course these are in the
+            * wrong order (00 0), not that it matters.
             */
            outbits(out, 0, 3);
 
@@ -1258,6 +1259,8 @@ int zlib_decompress_block(void *handle, unsigned char *block, int len,
                goto finished;
            nlen = dctx->bits & 0xFFFF;
            EATBITS(16);
+           if (dctx->uncomplen != (nlen ^ 0xFFFF))
+               goto decode_error;
            if (dctx->uncomplen == 0)
                dctx->state = OUTSIDEBLK;       /* block is empty */
            else