!47 security: Fix CVE-2022-37434

Merge pull request !47 from 施其昌/master
This commit is contained in:
openharmony_ci 2022-11-23 03:32:24 +00:00 committed by Gitee
commit 56b5b18fab
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -769,9 +769,10 @@ int ZEXPORT inflate(
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);