SSH CRC attack detector now uses a dynamically allocated context.
[u/mdw/putty] / sshzlib.c
index cf471db..91b29a0 100644 (file)
--- a/sshzlib.c
+++ b/sshzlib.c
 #include <stdlib.h>
 #include <assert.h>
 
-/* FIXME */
-#include <windows.h>
-#include <stdio.h>
-#include "putty.h"
-
 #include "ssh.h"
 
+#ifndef FALSE
+#define FALSE 0
+#define TRUE (!FALSE)
+#endif
+
 /* ----------------------------------------------------------------------
  * Basic LZ77 code. This bit is designed modularly, so it could be
  * ripped out and used in a different LZ77 compressor. Go to it,
@@ -1164,7 +1164,10 @@ int zlib_decompress_block(unsigned char *block, int len,
                goto finished;
            nlen = dctx.bits & 0xFFFF;
            EATBITS(16);
-           dctx.state = UNCOMP_DATA;
+           if (dctx.uncomplen == 0)
+               dctx.state = OUTSIDEBLK;        /* block is empty */
+           else
+               dctx.state = UNCOMP_DATA;
            break;
          case UNCOMP_DATA:
            if (dctx.nbits < 8)