diff options
| author | Mark Adler <git@madler.net> | 2026-01-11 09:46:29 -0800 |
|---|---|---|
| committer | Mark Adler <git@madler.net> | 2026-01-11 09:50:44 -0800 |
| commit | ecbaf031f81ddfcff200dcfd052df48c9047f3cf (patch) | |
| tree | d2f44cde32c1d2f490b131853ab6c6f58d655710 /inflate.c | |
| parent | 84045903ee415efbfaf6d3d443224c2f3a1daea0 (diff) | |
| download | zlib-ecbaf031f81ddfcff200dcfd052df48c9047f3cf.tar.gz zlib-ecbaf031f81ddfcff200dcfd052df48c9047f3cf.tar.bz2 zlib-ecbaf031f81ddfcff200dcfd052df48c9047f3cf.zip | |
Zero inflate state on allocation.
To further guard against the propagation of uninitialized memory.
Diffstat (limited to 'inflate.c')
| -rw-r--r-- | inflate.c | 2 |
1 files changed, 2 insertions, 0 deletions
| @@ -197,6 +197,7 @@ int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, | |||
| 197 | state = (struct inflate_state FAR *) | 197 | state = (struct inflate_state FAR *) |
| 198 | ZALLOC(strm, 1, sizeof(struct inflate_state)); | 198 | ZALLOC(strm, 1, sizeof(struct inflate_state)); |
| 199 | if (state == Z_NULL) return Z_MEM_ERROR; | 199 | if (state == Z_NULL) return Z_MEM_ERROR; |
| 200 | zmemzero(state, sizeof(struct inflate_state)); | ||
| 200 | Tracev((stderr, "inflate: allocated\n")); | 201 | Tracev((stderr, "inflate: allocated\n")); |
| 201 | strm->state = (struct internal_state FAR *)state; | 202 | strm->state = (struct internal_state FAR *)state; |
| 202 | state->strm = strm; | 203 | state->strm = strm; |
| @@ -1338,6 +1339,7 @@ int ZEXPORT inflateCopy(z_streamp dest, z_streamp source) { | |||
| 1338 | copy = (struct inflate_state FAR *) | 1339 | copy = (struct inflate_state FAR *) |
| 1339 | ZALLOC(source, 1, sizeof(struct inflate_state)); | 1340 | ZALLOC(source, 1, sizeof(struct inflate_state)); |
| 1340 | if (copy == Z_NULL) return Z_MEM_ERROR; | 1341 | if (copy == Z_NULL) return Z_MEM_ERROR; |
| 1342 | zmemzero(copy, sizeof(struct inflate_state)); | ||
| 1341 | window = Z_NULL; | 1343 | window = Z_NULL; |
| 1342 | if (state->window != Z_NULL) { | 1344 | if (state->window != Z_NULL) { |
| 1343 | window = (unsigned char FAR *) | 1345 | window = (unsigned char FAR *) |
