* [oe-core][PATCH 1/1] unzip: fix CVE-2021-4217
@ 2022-03-31 18:42 Joe Slater
2022-03-31 18:47 ` Alexander Kanavin
0 siblings, 1 reply; 3+ messages in thread
From: Joe Slater @ 2022-03-31 18:42 UTC (permalink / raw)
To: openembedded-core; +Cc: joe.slater, randy.macleod
Avoid a null pointer dereference.
Signed-off-by: Joe Slater <joe.slater@windriver.com>
---
.../unzip/unzip/CVE-2021-4217.patch | 65 +++++++++++++++++++
meta/recipes-extended/unzip/unzip_6.0.bb | 1 +
2 files changed, 66 insertions(+)
create mode 100644 meta/recipes-extended/unzip/unzip/CVE-2021-4217.patch
diff --git a/meta/recipes-extended/unzip/unzip/CVE-2021-4217.patch b/meta/recipes-extended/unzip/unzip/CVE-2021-4217.patch
new file mode 100644
index 0000000000..7262d14df4
--- /dev/null
+++ b/meta/recipes-extended/unzip/unzip/CVE-2021-4217.patch
@@ -0,0 +1,65 @@
+From 731d698377dbd1f5b1b90efeb8094602ed59fc40 Mon Sep 17 00:00:00 2001
+From: Nils Bars <nils.bars@t-online.de>
+Date: Mon, 17 Jan 2022 16:53:16 +0000
+Subject: [PATCH] Fix null pointer dereference and use of uninitialized data
+
+This fixes a bug that causes use of uninitialized heap data if `readbuf` fails
+to read as many bytes as indicated by the extra field length attribute.
+Furthermore, this fixes a null pointer dereference if an archive contains an
+`EF_UNIPATH` extra field but does not have a filename set.
+---
+ fileio.c | 5 ++++-
+ process.c | 6 +++++-
+ 2 files changed, 9 insertions(+), 2 deletions(-)
+---
+
+https://launchpadlibrarian.net/580782282/0001-Fix-null-pointer-dereference-and-use-of-uninitialized-data.patch
+Regenerated to apply without offsets.
+
+CVE: CVE-2021-4217
+
+Upstream-Status: Inappropriate [not author]
+
+Signed-off-by: Joe Slater <joe.slater@windriver.com>
+
+
+diff --git a/fileio.c b/fileio.c
+index 14460f3..1dc319e 100644
+--- a/fileio.c
++++ b/fileio.c
+@@ -2301,8 +2301,11 @@ int do_string(__G__ length, option) /* return PK-type error code */
+ seek_zipf(__G__ G.cur_zipfile_bufstart - G.extra_bytes +
+ (G.inptr-G.inbuf) + length);
+ } else {
+- if (readbuf(__G__ (char *)G.extra_field, length) == 0)
++ unsigned bytes_read = readbuf(__G__ (char *)G.extra_field, length);
++ if (bytes_read == 0)
+ return PK_EOF;
++ if (bytes_read != length)
++ return PK_ERR;
+ /* Looks like here is where extra fields are read */
+ if (getZip64Data(__G__ G.extra_field, length) != PK_COOL)
+ {
+diff --git a/process.c b/process.c
+index 5f8f6c6..de843a5 100644
+--- a/process.c
++++ b/process.c
+@@ -2058,10 +2058,14 @@ int getUnicodeData(__G__ ef_buf, ef_len)
+ G.unipath_checksum = makelong(offset + ef_buf);
+ offset += 4;
+
++ if (!G.filename_full) {
++ /* Check if we have a unicode extra section but no filename set */
++ return PK_ERR;
++ }
++
+ /*
+ * Compute 32-bit crc
+ */
+-
+ chksum = crc32(chksum, (uch *)(G.filename_full),
+ strlen(G.filename_full));
+
+--
+2.32.0
+
diff --git a/meta/recipes-extended/unzip/unzip_6.0.bb b/meta/recipes-extended/unzip/unzip_6.0.bb
index af94a39195..c222a684b4 100644
--- a/meta/recipes-extended/unzip/unzip_6.0.bb
+++ b/meta/recipes-extended/unzip/unzip_6.0.bb
@@ -28,6 +28,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/infozip/UnZip%206.x%20%28latest%29/UnZip%206.0/
file://CVE-2019-13232_p3.patch \
file://unzip_optimization.patch \
file://0001-configure-Pass-LDFLAGS-to-tests-doing-link-step.patch \
+ file://CVE-2021-4217.patch \
"
UPSTREAM_VERSION_UNKNOWN = "1"
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [oe-core][PATCH 1/1] unzip: fix CVE-2021-4217
2022-03-31 18:42 [oe-core][PATCH 1/1] unzip: fix CVE-2021-4217 Joe Slater
@ 2022-03-31 18:47 ` Alexander Kanavin
2022-04-04 12:01 ` Richard Purdie
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Kanavin @ 2022-03-31 18:47 UTC (permalink / raw)
To: Joe Slater; +Cc: OE-core, Randy MacLeod
The origin of the patch needs to be better explained, right now it
seems like a random thing off the internet. Upstream-Status is
certainly not inappropriate, as it is a security fix.
Alex
On Thu, 31 Mar 2022 at 20:42, Joe Slater <joe.slater@windriver.com> wrote:
>
> Avoid a null pointer dereference.
>
> Signed-off-by: Joe Slater <joe.slater@windriver.com>
> ---
> .../unzip/unzip/CVE-2021-4217.patch | 65 +++++++++++++++++++
> meta/recipes-extended/unzip/unzip_6.0.bb | 1 +
> 2 files changed, 66 insertions(+)
> create mode 100644 meta/recipes-extended/unzip/unzip/CVE-2021-4217.patch
>
> diff --git a/meta/recipes-extended/unzip/unzip/CVE-2021-4217.patch b/meta/recipes-extended/unzip/unzip/CVE-2021-4217.patch
> new file mode 100644
> index 0000000000..7262d14df4
> --- /dev/null
> +++ b/meta/recipes-extended/unzip/unzip/CVE-2021-4217.patch
> @@ -0,0 +1,65 @@
> +From 731d698377dbd1f5b1b90efeb8094602ed59fc40 Mon Sep 17 00:00:00 2001
> +From: Nils Bars <nils.bars@t-online.de>
> +Date: Mon, 17 Jan 2022 16:53:16 +0000
> +Subject: [PATCH] Fix null pointer dereference and use of uninitialized data
> +
> +This fixes a bug that causes use of uninitialized heap data if `readbuf` fails
> +to read as many bytes as indicated by the extra field length attribute.
> +Furthermore, this fixes a null pointer dereference if an archive contains an
> +`EF_UNIPATH` extra field but does not have a filename set.
> +---
> + fileio.c | 5 ++++-
> + process.c | 6 +++++-
> + 2 files changed, 9 insertions(+), 2 deletions(-)
> +---
> +
> +https://launchpadlibrarian.net/580782282/0001-Fix-null-pointer-dereference-and-use-of-uninitialized-data.patch
> +Regenerated to apply without offsets.
> +
> +CVE: CVE-2021-4217
> +
> +Upstream-Status: Inappropriate [not author]
> +
> +Signed-off-by: Joe Slater <joe.slater@windriver.com>
> +
> +
> +diff --git a/fileio.c b/fileio.c
> +index 14460f3..1dc319e 100644
> +--- a/fileio.c
> ++++ b/fileio.c
> +@@ -2301,8 +2301,11 @@ int do_string(__G__ length, option) /* return PK-type error code */
> + seek_zipf(__G__ G.cur_zipfile_bufstart - G.extra_bytes +
> + (G.inptr-G.inbuf) + length);
> + } else {
> +- if (readbuf(__G__ (char *)G.extra_field, length) == 0)
> ++ unsigned bytes_read = readbuf(__G__ (char *)G.extra_field, length);
> ++ if (bytes_read == 0)
> + return PK_EOF;
> ++ if (bytes_read != length)
> ++ return PK_ERR;
> + /* Looks like here is where extra fields are read */
> + if (getZip64Data(__G__ G.extra_field, length) != PK_COOL)
> + {
> +diff --git a/process.c b/process.c
> +index 5f8f6c6..de843a5 100644
> +--- a/process.c
> ++++ b/process.c
> +@@ -2058,10 +2058,14 @@ int getUnicodeData(__G__ ef_buf, ef_len)
> + G.unipath_checksum = makelong(offset + ef_buf);
> + offset += 4;
> +
> ++ if (!G.filename_full) {
> ++ /* Check if we have a unicode extra section but no filename set */
> ++ return PK_ERR;
> ++ }
> ++
> + /*
> + * Compute 32-bit crc
> + */
> +-
> + chksum = crc32(chksum, (uch *)(G.filename_full),
> + strlen(G.filename_full));
> +
> +--
> +2.32.0
> +
> diff --git a/meta/recipes-extended/unzip/unzip_6.0.bb b/meta/recipes-extended/unzip/unzip_6.0.bb
> index af94a39195..c222a684b4 100644
> --- a/meta/recipes-extended/unzip/unzip_6.0.bb
> +++ b/meta/recipes-extended/unzip/unzip_6.0.bb
> @@ -28,6 +28,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/infozip/UnZip%206.x%20%28latest%29/UnZip%206.0/
> file://CVE-2019-13232_p3.patch \
> file://unzip_optimization.patch \
> file://0001-configure-Pass-LDFLAGS-to-tests-doing-link-step.patch \
> + file://CVE-2021-4217.patch \
> "
> UPSTREAM_VERSION_UNKNOWN = "1"
>
> --
> 2.35.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#163865): https://lists.openembedded.org/g/openembedded-core/message/163865
> Mute This Topic: https://lists.openembedded.org/mt/90161682/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [oe-core][PATCH 1/1] unzip: fix CVE-2021-4217
2022-03-31 18:47 ` Alexander Kanavin
@ 2022-04-04 12:01 ` Richard Purdie
0 siblings, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2022-04-04 12:01 UTC (permalink / raw)
To: Alexander Kanavin, Joe Slater; +Cc: OE-core, Randy MacLeod
On Thu, 2022-03-31 at 20:47 +0200, Alexander Kanavin wrote:
> The origin of the patch needs to be better explained, right now it
> seems like a random thing off the internet. Upstream-Status is
> certainly not inappropriate, as it is a security fix.
I've tweaked the headers a bit on this to show the launchpad discussion where it
came from and marked it as Pending. The upstream in this case is long inactive
unfortunately :(.
Cheers,
Richard
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-04 18:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-31 18:42 [oe-core][PATCH 1/1] unzip: fix CVE-2021-4217 Joe Slater
2022-03-31 18:47 ` Alexander Kanavin
2022-04-04 12:01 ` Richard Purdie
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.