diff options
author | Mark Adler <fork@madler.net> | 2022-07-30 15:51:11 -0700 |
---|---|---|
committer | Toomas Soome <tsoome@me.com> | 2022-08-20 01:15:13 +0300 |
commit | 2e401babeb53295c8df347e32364beadc0ed1620 (patch) | |
tree | 44a2d0af5dc1b0281c5c1aab831ea0b40b309fce /usr/src | |
parent | 8942719269eba26304a9de8478e842928c665dfc (diff) | |
download | illumos-joyent-2e401babeb53295c8df347e32364beadc0ed1620.tar.gz |
14917 zlib: Fix a bug when getting a gzip header extra field with inflate().
Reviewed-by: Toomas Soome <tsoome@me.com>
Reviewed by: Gordon Ross <Gordon.W.Ross@gmail.com>
Approved by: Dan McDonald <danmcd@mnx.io>
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/contrib/zlib/inflate.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr/src/contrib/zlib/inflate.c b/usr/src/contrib/zlib/inflate.c index baf5bb872e..9ad66f2287 100644 --- a/usr/src/contrib/zlib/inflate.c +++ b/usr/src/contrib/zlib/inflate.c @@ -744,8 +744,9 @@ int ZEXPORT inflate(z_streamp strm, int flush) if (copy > have) copy = have; if (copy) { if (state->head != Z_NULL && - state->head->extra != Z_NULL) { - len = state->head->extra_len - state->length; + state->head->extra != Z_NULL && + (len = state->head->extra_len - state->length) < + state->head->extra_max) { zmemcpy(state->head->extra + len, next, len + copy > state->head->extra_max ? state->head->extra_max - len : copy); |