From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: Christian Melki <christian.melki@t2data.com>
Subject: Re: [ptxdist] [APPLIED] zlib: Fix CVE-2022-37434.
Date: Sun, 11 Sep 2022 09:10:19 +0200 [thread overview]
Message-ID: <20220911071019.2274776-1-m.olbrich@pengutronix.de> (raw)
In-Reply-To: <20220907102811.628405-1-christian.melki@t2data.com>
Thanks, applied as 90f7f51f26313d27d1e0021f623c8746c12d109b.
Michael
[sent from post-receive hook]
On Sun, 11 Sep 2022 09:10:18 +0200, Christian Melki <christian.melki@t2data.com> wrote:
> Severity score of 9.8.
> https://nvd.nist.gov/vuln/detail/CVE-2022-37434
> Patches taken from zlib develop branch.
>
> https://github.com/madler/zlib/commit/1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d
> https://github.com/madler/zlib/commit/eff308af425b67093bab25f80f1ae950166bece1
>
> Signed-off-by: Christian Melki <christian.melki@t2data.com>
> Message-Id: <20220907102811.628405-1-christian.melki@t2data.com>
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
>
> diff --git a/patches/zlib-1.2.12/0002-Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch b/patches/zlib-1.2.12/0002-Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch
> new file mode 100644
> index 000000000000..e8b36be46ac3
> --- /dev/null
> +++ b/patches/zlib-1.2.12/0002-Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch
> @@ -0,0 +1,31 @@
> +From: Mark Adler <fork@madler.net>
> +Date: Sat, 30 Jul 2022 15:51:11 -0700
> +Subject: [PATCH] Fix a bug when getting a gzip header extra field with
> + inflate().
> +
> +If the extra field was larger than the space the user provided with
> +inflateGetHeader(), and if multiple calls of inflate() delivered
> +the extra header data, then there could be a buffer overflow of the
> +provided space. This commit assures that provided space is not
> +exceeded.
> +---
> + inflate.c | 5 +++--
> + 1 file changed, 3 insertions(+), 2 deletions(-)
> +
> +diff --git a/inflate.c b/inflate.c
> +index 7be8c63662a7..7a728974923a 100644
> +--- a/inflate.c
> ++++ b/inflate.c
> +@@ -763,9 +763,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);
> diff --git a/patches/zlib-1.2.12/0003-Fix-extra-field-processing-bug-that-dereferences-NUL.patch b/patches/zlib-1.2.12/0003-Fix-extra-field-processing-bug-that-dereferences-NUL.patch
> new file mode 100644
> index 000000000000..381c5212898c
> --- /dev/null
> +++ b/patches/zlib-1.2.12/0003-Fix-extra-field-processing-bug-that-dereferences-NUL.patch
> @@ -0,0 +1,28 @@
> +From: Mark Adler <fork@madler.net>
> +Date: Mon, 8 Aug 2022 10:50:09 -0700
> +Subject: [PATCH] Fix extra field processing bug that dereferences NULL
> + state->head.
> +
> +The recent commit to fix a gzip header extra field processing bug
> +introduced the new bug fixed here.
> +---
> + inflate.c | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/inflate.c b/inflate.c
> +index 7a728974923a..2a3c4fe98464 100644
> +--- a/inflate.c
> ++++ b/inflate.c
> +@@ -763,10 +763,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_max) {
> ++ (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);
> diff --git a/patches/zlib-1.2.12/series b/patches/zlib-1.2.12/series
> index ac92b3ba7f39..5287c5835744 100644
> --- a/patches/zlib-1.2.12/series
> +++ b/patches/zlib-1.2.12/series
> @@ -1,4 +1,6 @@
> # generated by git-ptx-patches
> #tag:base --start-number 1
> 0001-Fix-configure-issue-that-discarded-provided-CC-defin.patch
> -# 5dfc5088b94416c3eb59b1a207bdec70 - git-ptx-patches magic
> +0002-Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch
> +0003-Fix-extra-field-processing-bug-that-dereferences-NUL.patch
> +# cd27facc69e3374f1354a2aca57309ec - git-ptx-patches magic
prev parent reply other threads:[~2022-09-11 7:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-07 10:28 [ptxdist] [PATCH] " Christian Melki
2022-09-11 7:10 ` Michael Olbrich [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220911071019.2274776-1-m.olbrich@pengutronix.de \
--to=m.olbrich@pengutronix.de \
--cc=christian.melki@t2data.com \
--cc=ptxdist@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox