summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Marko <peter.marko@siemens.com>2023-10-19 20:30:01 +0200
committerSteve Sakoman <steve@sakoman.com>2023-10-25 04:45:50 -1000
commite06868eff3e849a2a47633fbb952df6611ea6fa5 (patch)
tree98fc73153453ae8330ac72d4d95bfa8029413e27
parent024fa046fc81d87d488a0d41cabcd0872ef0b1e3 (diff)
downloadpoky-e06868eff3e849a2a47633fbb952df6611ea6fa5.tar.gz
zlib: patch CVE-2023-45853
Backport commit merged to develop branch from PR linked in NVD report: * https://nvd.nist.gov/vuln/detail/CVE-2023-45853 * https://github.com/madler/zlib/pull/843 (From OE-Core rev: 6e265e44febbb6fdf85c7926b9a64b731c98d814) Signed-off-by: Peter Marko <peter.marko@siemens.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-core/zlib/zlib/CVE-2023-45853.patch42
-rw-r--r--meta/recipes-core/zlib/zlib_1.2.11.bb1
2 files changed, 43 insertions, 0 deletions
diff --git a/meta/recipes-core/zlib/zlib/CVE-2023-45853.patch b/meta/recipes-core/zlib/zlib/CVE-2023-45853.patch
new file mode 100644
index 0000000000..ba3709249b
--- /dev/null
+++ b/meta/recipes-core/zlib/zlib/CVE-2023-45853.patch
@@ -0,0 +1,42 @@
1From 73331a6a0481067628f065ffe87bb1d8f787d10c Mon Sep 17 00:00:00 2001
2From: Hans Wennborg <hans@chromium.org>
3Date: Fri, 18 Aug 2023 11:05:33 +0200
4Subject: [PATCH] Reject overflows of zip header fields in minizip.
5
6This checks the lengths of the file name, extra field, and comment
7that would be put in the zip headers, and rejects them if they are
8too long. They are each limited to 65535 bytes in length by the zip
9format. This also avoids possible buffer overflows if the provided
10fields are too long.
11
12CVE: CVE-2023-45853
13Upstream-Status: Backport [https://github.com/madler/zlib/commit/73331a6a0481067628f065ffe87bb1d8f787d10c]
14
15Signed-off-by: Peter Marko <peter.marko@siemens.com>
16
17---
18 contrib/minizip/zip.c | 11 +++++++++++
19 1 file changed, 11 insertions(+)
20
21diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c
22index 3d3d4cadd..0446109b2 100644
23--- a/contrib/minizip/zip.c
24+++ b/contrib/minizip/zip.c
25@@ -1043,6 +1043,17 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, c
26 return ZIP_PARAMERROR;
27 #endif
28
29+ // The filename and comment length must fit in 16 bits.
30+ if ((filename!=NULL) && (strlen(filename)>0xffff))
31+ return ZIP_PARAMERROR;
32+ if ((comment!=NULL) && (strlen(comment)>0xffff))
33+ return ZIP_PARAMERROR;
34+ // The extra field length must fit in 16 bits. If the member also requires
35+ // a Zip64 extra block, that will also need to fit within that 16-bit
36+ // length, but that will be checked for later.
37+ if ((size_extrafield_local>0xffff) || (size_extrafield_global>0xffff))
38+ return ZIP_PARAMERROR;
39+
40 zi = (zip64_internal*)file;
41
42 if (zi->in_opened_file_inzip == 1)
diff --git a/meta/recipes-core/zlib/zlib_1.2.11.bb b/meta/recipes-core/zlib/zlib_1.2.11.bb
index f768b41988..d75474dcb6 100644
--- a/meta/recipes-core/zlib/zlib_1.2.11.bb
+++ b/meta/recipes-core/zlib/zlib_1.2.11.bb
@@ -12,6 +12,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/libpng/${BPN}/${PV}/${BPN}-${PV}.tar.xz \
12 file://CVE-2018-25032.patch \ 12 file://CVE-2018-25032.patch \
13 file://run-ptest \ 13 file://run-ptest \
14 file://CVE-2022-37434.patch \ 14 file://CVE-2022-37434.patch \
15 file://CVE-2023-45853.patch \
15 " 16 "
16UPSTREAM_CHECK_URI = "http://zlib.net/" 17UPSTREAM_CHECK_URI = "http://zlib.net/"
17 18