From 354562ca60b80b351e8d4bddd772929a14efdfcc Mon Sep 17 00:00:00 2001 From: jacob Date: Tue, 1 Mar 2011 23:44:06 +0000 Subject: [PATCH] Add some extra validation to zlib decompression (primarily to shut up a GCC 4.6 warning). git-svn-id: svn://svn.tartarus.org/sgt/putty@9113 cda61777-01e9-0310-a592-d414129be87e --- sshzlib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sshzlib.c b/sshzlib.c index 9c801325..cc287240 100644 --- a/sshzlib.c +++ b/sshzlib.c @@ -1259,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 -- 2.11.0