[Zlib-devel] [PATCH] Fix segfault when NULL is passed as path to gzopen*
Ozgur Murat Homurlu
ozgurmurath at gmail.com
Wed Dec 15 17:01:47 EST 2010
Hi,
In gz_open function, path parameter is passed to strlen() without
checking. This causes a segmentation fault if path is passed as NULL.
This patch adds the check:
--- zlib-1.2.5/gzlib.c 2010-04-18 20:53:22.000000000 +0300
+++ zlib-1.2.5-fixed/gzlib.c 2010-12-15 11:31:21.991003500 +0200
@@ -91,6 +91,9 @@
{
gz_statep state;
+ if (path == NULL)
+ return NULL;
+
/* allocate gzFile structure to return */
state = malloc(sizeof(gz_state));
if (state == NULL)
More information about the Zlib-devel
mailing list