lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Thu, 20 Jan 2011 21:54:08 +0100 (CET)
From:	Jesper Juhl <jj@...osbits.net>
To:	Phillip Lougher <phillip@...gher.demon.co.uk>
cc:	linux-kernel@...r.kernel.org
Subject: [PATCH] SquashFS, zlib: Don't use uninitialized variable in
 zlib_uncompress

In fs/squashfs/zlib_wrapper.c::zlib_uncompress() we have this code:

	int zlib_err, zlib_init = 0;
	...
	do {
		if (stream->avail_in == 0 && k < b) {
		... [no code that assigns to 'zlib_err'] ...
			if (avail == 0) {
				offset = 0;
				put_bh(bh[k++]);
				continue;
			}
		...
	} while (zlib_err == Z_OK);

If we hit that 'continue' statement the first time through, then the
'while' condition will be testing an uninitialized 'zlib_err' - not what 
we want.

This patch should take care of the problem by making sure that 'zlib_err' 
is initialized to 'Z_OK' at the start of the function.

Signed-off-by: Jesper Juhl <jj@...osbits.net>
---
 zlib_wrapper.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

  Compile tested only.

diff --git a/fs/squashfs/zlib_wrapper.c b/fs/squashfs/zlib_wrapper.c
index 818a5e0..5970993 100644
--- a/fs/squashfs/zlib_wrapper.c
+++ b/fs/squashfs/zlib_wrapper.c
@@ -65,7 +65,7 @@ static int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer,
 	struct buffer_head **bh, int b, int offset, int length, int srclength,
 	int pages)
 {
-	int zlib_err, zlib_init = 0;
+	int zlib_err = Z_OK, zlib_init = 0;
 	int k = 0, page = 0;
 	z_stream *stream = msblk->stream;
 

-- 
Jesper Juhl <jj@...osbits.net>            http://www.chaosbits.net/
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ