X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=sshzlib.c;h=05fa57722a56810c607260d9e94ebf28ffc4b4b3;hb=afa871e3cfc82eb6b92b02fd1dad094c5d1949f2;hp=94f0b80c8207d4d2343dfe8ed4fac39b8f457473;hpb=2226098a9e171ac2434df91c848b1b286e2d481e;p=PuTTY.git diff --git a/sshzlib.c b/sshzlib.c index 94f0b80c..05fa5772 100644 --- a/sshzlib.c +++ b/sshzlib.c @@ -38,6 +38,7 @@ */ #include +#include #include #ifdef ZLIB_STANDALONE @@ -224,6 +225,7 @@ static void lz77_compress(struct LZ77Context *ctx, } st->npending -= i; + defermatch.distance = 0; /* appease compiler */ defermatch.len = 0; deferchr = '\0'; while (len > 0) { @@ -1258,6 +1260,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 @@ -1368,6 +1372,7 @@ int main(int argc, char **argv) const struct ssh_compress ssh_zlib = { "zlib", + "zlib@openssh.com", /* delayed version */ zlib_compress_init, zlib_compress_cleanup, zlib_compress_block,