Fix a bug when getting a gzip header extra field with inflate() (#2471)

This commit is contained in:
Phuc-Thanh Nguyen 2025-04-28 17:17:58 +08:00 committed by GitHub
parent c4852a7104
commit b15cf9dfa4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -758,9 +758,10 @@ int flush;
copy = state->length;
if (copy > have) copy = have;
if (copy) {
len = state->head->extra_len - state->length;
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_max) {
zmemcpy(state->head->extra + len, next,
len + copy > state->head->extra_max ?
state->head->extra_max - len : copy);