X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=sshzlib.c;h=ee1bc42d3054b8707ea41ffa04da5719048ec205;hb=08d4ca078763518ba377ac59a86a1580e6214c27;hp=8a64e3563ee6318104d26a19b753dacd8385cd2a;hpb=e2a5c6b6799ddfa9ca03b6f7fd13d0012e7b2977;p=PuTTY.git diff --git a/sshzlib.c b/sshzlib.c index 8a64e356..ee1bc42d 100644 --- a/sshzlib.c +++ b/sshzlib.c @@ -1234,6 +1234,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 +1366,7 @@ int main(int argc, char **argv) sfree(outbuf); } else { fprintf(stderr, "decoding error\n"); + fclose(fp); return 1; } }