mirror of
https://github.com/curl/curl.git
synced 2024-11-27 05:50:21 +08:00
zlib: enforce full initialization of our data space z_stream structs
This commit is contained in:
parent
1833984664
commit
9afb343368
@ -158,11 +158,7 @@ Curl_unencode_deflate_write(struct connectdata *conn,
|
|||||||
|
|
||||||
/* Initialize zlib? */
|
/* Initialize zlib? */
|
||||||
if(k->zlib_init == ZLIB_UNINIT) {
|
if(k->zlib_init == ZLIB_UNINIT) {
|
||||||
z->zalloc = (alloc_func)Z_NULL;
|
memset(z, 0, sizeof(z_stream));
|
||||||
z->zfree = (free_func)Z_NULL;
|
|
||||||
z->opaque = 0;
|
|
||||||
z->next_in = NULL;
|
|
||||||
z->avail_in = 0;
|
|
||||||
if(inflateInit(z) != Z_OK)
|
if(inflateInit(z) != Z_OK)
|
||||||
return process_zlib_error(conn, z);
|
return process_zlib_error(conn, z);
|
||||||
k->zlib_init = ZLIB_INIT;
|
k->zlib_init = ZLIB_INIT;
|
||||||
@ -269,11 +265,7 @@ Curl_unencode_gzip_write(struct connectdata *conn,
|
|||||||
|
|
||||||
/* Initialize zlib? */
|
/* Initialize zlib? */
|
||||||
if(k->zlib_init == ZLIB_UNINIT) {
|
if(k->zlib_init == ZLIB_UNINIT) {
|
||||||
z->zalloc = (alloc_func)Z_NULL;
|
memset(z, 0, sizeof(z_stream));
|
||||||
z->zfree = (free_func)Z_NULL;
|
|
||||||
z->opaque = 0;
|
|
||||||
z->next_in = NULL;
|
|
||||||
z->avail_in = 0;
|
|
||||||
|
|
||||||
if(strcmp(zlibVersion(), "1.2.0.4") >= 0) {
|
if(strcmp(zlibVersion(), "1.2.0.4") >= 0) {
|
||||||
/* zlib ver. >= 1.2.0.4 supports transparent gzip decompressing */
|
/* zlib ver. >= 1.2.0.4 supports transparent gzip decompressing */
|
||||||
|
@ -177,11 +177,9 @@ void hugehelp(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
headerlen = 10;
|
headerlen = 10;
|
||||||
|
memset(&z, 0, sizeof(z_stream));
|
||||||
z.avail_in = (unsigned int)(sizeof(hugehelpgz) - headerlen);
|
z.avail_in = (unsigned int)(sizeof(hugehelpgz) - headerlen);
|
||||||
z.next_in = (unsigned char *)hugehelpgz + headerlen;
|
z.next_in = (unsigned char *)hugehelpgz + headerlen;
|
||||||
z.zalloc = (alloc_func)Z_NULL;
|
|
||||||
z.zfree = (free_func)Z_NULL;
|
|
||||||
z.opaque = 0;
|
|
||||||
|
|
||||||
if (inflateInit2(&z, -MAX_WBITS) != Z_OK)
|
if (inflateInit2(&z, -MAX_WBITS) != Z_OK)
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user