]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - sshzlib.c
Remove assorted dead code.
[PuTTY.git] / sshzlib.c
index 8a64e3563ee6318104d26a19b753dacd8385cd2a..e7a4c63cb97ad1b2233b694e264477bed49e6bdc 100644 (file)
--- a/sshzlib.c
+++ b/sshzlib.c
@@ -267,7 +267,6 @@ static void lz77_compress(struct LZ77Context *ctx,
            }
        } else {
            nmatch = 0;
-           hash = INVALID;
        }
 
        if (nmatch > 0) {
@@ -1234,6 +1233,8 @@ int zlib_decompress_block(void *handle, unsigned char *block, int len,
                goto finished;
            if (code == -2)
                goto decode_error;
+           if (code >= 30)            /* dist symbols 30 and 31 are invalid */
+               goto decode_error;
            dctx->state = GOTDISTSYM;
            dctx->sym = code;
            break;
@@ -1364,6 +1365,7 @@ int main(int argc, char **argv)
             sfree(outbuf);
         } else {
             fprintf(stderr, "decoding error\n");
+            fclose(fp);
             return 1;
         }
     }