From 73d299adf08136f2fee37aec4e8cd739bc54743a Mon Sep 17 00:00:00 2001 From: wanghang Date: Mon, 15 Aug 2022 11:25:44 +0800 Subject: [PATCH] fixed ae3b7fc from https://gitee.com/small_bricklayer/third_party_zlib/pulls/42 IssueNo:#I5MAFM Description:security: Fix CVE-2022-37434 Sig:SIG_ApplicaitonFramework Feature or Bugfix:Bugfix Binary Source:No Signed-off-by: wanghang Change-Id: If307873d4eeb639f4c86ac7ca4dd2057e9522070 --- inflate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/inflate.c b/inflate.c index 7be8c63..2a3c4fe 100644 --- a/inflate.c +++ b/inflate.c @@ -764,8 +764,9 @@ 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);