diff options
author | Kai Kang <kai.kang@windriver.com> | 2022-02-23 11:15:29 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-02 00:22:12 +0000 |
commit | b94f4ca8efd359cf00a3b9d8f3bc8e06e7081573 (patch) | |
tree | 7acde77a9b7491ac09d6012c90386f2aec4c2b3e | |
parent | 73a75034b9b7352801617472c7e961e820cecbee (diff) | |
download | poky-b94f4ca8efd359cf00a3b9d8f3bc8e06e7081573.tar.gz |
expat: fix CVE-2022-23990
CVE: CVE-2022-23990
Based on Steve Sakoman's patch for branch dunfell, fix CVE-2022-23990
for expat in branch hardknott.
And correct indent as well.
(From OE-Core rev: dc30243e7cc1b1c392b999de114b4096d432ef02)
Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-core/expat/expat/CVE-2022-23990.patch | 49 | ||||
-rw-r--r-- | meta/recipes-core/expat/expat_2.2.10.bb | 7 |
2 files changed, 53 insertions, 3 deletions
diff --git a/meta/recipes-core/expat/expat/CVE-2022-23990.patch b/meta/recipes-core/expat/expat/CVE-2022-23990.patch new file mode 100644 index 0000000000..c599517b3e --- /dev/null +++ b/meta/recipes-core/expat/expat/CVE-2022-23990.patch | |||
@@ -0,0 +1,49 @@ | |||
1 | From ede41d1e186ed2aba88a06e84cac839b770af3a1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Sebastian Pipping <sebastian@pipping.org> | ||
3 | Date: Wed, 26 Jan 2022 02:36:43 +0100 | ||
4 | Subject: [PATCH] lib: Prevent integer overflow in doProlog (CVE-2022-23990) | ||
5 | |||
6 | The change from "int nameLen" to "size_t nameLen" | ||
7 | addresses the overflow on "nameLen++" in code | ||
8 | "for (; name[nameLen++];)" right above the second | ||
9 | change in the patch. | ||
10 | |||
11 | Upstream-Status: Backport: | ||
12 | https://github.com/libexpat/libexpat/pull/551/commits/ede41d1e186ed2aba88a06e84cac839b770af3a1 | ||
13 | |||
14 | CVE: CVE-2022-23990 | ||
15 | |||
16 | Signed-off-by: Steve Sakoman <steve@sakoman.com> | ||
17 | |||
18 | --- | ||
19 | lib/xmlparse.c | 10 ++++++++-- | ||
20 | 1 file changed, 8 insertions(+), 2 deletions(-) | ||
21 | |||
22 | diff --git a/lib/xmlparse.c b/expat/lib/xmlparse.c | ||
23 | index 5ce31402..d1d17005 100644 | ||
24 | --- a/lib/xmlparse.c | ||
25 | +++ b/lib/xmlparse.c | ||
26 | @@ -5372,7 +5372,7 @@ doProlog(XML_Parser parser, const ENCODING *enc, const char *s, const char *end, | ||
27 | if (dtd->in_eldecl) { | ||
28 | ELEMENT_TYPE *el; | ||
29 | const XML_Char *name; | ||
30 | - int nameLen; | ||
31 | + size_t nameLen; | ||
32 | const char *nxt | ||
33 | = (quant == XML_CQUANT_NONE ? next : next - enc->minBytesPerChar); | ||
34 | int myindex = nextScaffoldPart(parser); | ||
35 | @@ -5388,7 +5388,13 @@ doProlog(XML_Parser parser, const ENCODING *enc, const char *s, const char *end, | ||
36 | nameLen = 0; | ||
37 | for (; name[nameLen++];) | ||
38 | ; | ||
39 | - dtd->contentStringLen += nameLen; | ||
40 | + | ||
41 | + /* Detect and prevent integer overflow */ | ||
42 | + if (nameLen > UINT_MAX - dtd->contentStringLen) { | ||
43 | + return XML_ERROR_NO_MEMORY; | ||
44 | + } | ||
45 | + | ||
46 | + dtd->contentStringLen += (unsigned)nameLen; | ||
47 | if (parser->m_elementDeclHandler) | ||
48 | handleDefault = XML_FALSE; | ||
49 | } | ||
diff --git a/meta/recipes-core/expat/expat_2.2.10.bb b/meta/recipes-core/expat/expat_2.2.10.bb index 074441dc2a..a851e54b2a 100644 --- a/meta/recipes-core/expat/expat_2.2.10.bb +++ b/meta/recipes-core/expat/expat_2.2.10.bb | |||
@@ -10,13 +10,14 @@ VERSION_TAG = "${@d.getVar('PV').replace('.', '_')}" | |||
10 | 10 | ||
11 | SRC_URI = "https://github.com/libexpat/libexpat/releases/download/R_${VERSION_TAG}/expat-${PV}.tar.bz2 \ | 11 | SRC_URI = "https://github.com/libexpat/libexpat/releases/download/R_${VERSION_TAG}/expat-${PV}.tar.bz2 \ |
12 | file://libtool-tag.patch \ | 12 | file://libtool-tag.patch \ |
13 | file://run-ptest \ | 13 | file://run-ptest \ |
14 | file://0001-Add-output-of-tests-result.patch \ | 14 | file://0001-Add-output-of-tests-result.patch \ |
15 | file://CVE-2022-22822-27.patch \ | 15 | file://CVE-2022-22822-27.patch \ |
16 | file://CVE-2021-45960.patch \ | 16 | file://CVE-2021-45960.patch \ |
17 | file://CVE-2021-46143.patch \ | 17 | file://CVE-2021-46143.patch \ |
18 | file://CVE-2022-23852.patch \ | 18 | file://CVE-2022-23852.patch \ |
19 | " | 19 | file://CVE-2022-23990.patch \ |
20 | " | ||
20 | 21 | ||
21 | UPSTREAM_CHECK_URI = "https://github.com/libexpat/libexpat/releases/" | 22 | UPSTREAM_CHECK_URI = "https://github.com/libexpat/libexpat/releases/" |
22 | 23 | ||