aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Adler <git@madler.net>2026-01-11 09:46:29 -0800
committerMark Adler <git@madler.net>2026-01-11 09:50:44 -0800
commitecbaf031f81ddfcff200dcfd052df48c9047f3cf (patch)
treed2f44cde32c1d2f490b131853ab6c6f58d655710
parent84045903ee415efbfaf6d3d443224c2f3a1daea0 (diff)
downloadzlib-ecbaf031f81ddfcff200dcfd052df48c9047f3cf.tar.gz
zlib-ecbaf031f81ddfcff200dcfd052df48c9047f3cf.tar.bz2
zlib-ecbaf031f81ddfcff200dcfd052df48c9047f3cf.zip
Zero inflate state on allocation.HEADdevelop
To further guard against the propagation of uninitialized memory.
-rw-r--r--inflate.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/inflate.c b/inflate.c
index 623c95b..f55949e 100644
--- a/inflate.c
+++ b/inflate.c
@@ -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 *)