mirror of
https://git.yoctoproject.org/poky
synced 2026-06-03 13:49:49 +00:00
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>
This commit is contained in:
@@ -0,0 +1,49 @@
|
|||||||
|
From ede41d1e186ed2aba88a06e84cac839b770af3a1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Sebastian Pipping <sebastian@pipping.org>
|
||||||
|
Date: Wed, 26 Jan 2022 02:36:43 +0100
|
||||||
|
Subject: [PATCH] lib: Prevent integer overflow in doProlog (CVE-2022-23990)
|
||||||
|
|
||||||
|
The change from "int nameLen" to "size_t nameLen"
|
||||||
|
addresses the overflow on "nameLen++" in code
|
||||||
|
"for (; name[nameLen++];)" right above the second
|
||||||
|
change in the patch.
|
||||||
|
|
||||||
|
Upstream-Status: Backport:
|
||||||
|
https://github.com/libexpat/libexpat/pull/551/commits/ede41d1e186ed2aba88a06e84cac839b770af3a1
|
||||||
|
|
||||||
|
CVE: CVE-2022-23990
|
||||||
|
|
||||||
|
Signed-off-by: Steve Sakoman <steve@sakoman.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
lib/xmlparse.c | 10 ++++++++--
|
||||||
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/xmlparse.c b/expat/lib/xmlparse.c
|
||||||
|
index 5ce31402..d1d17005 100644
|
||||||
|
--- a/lib/xmlparse.c
|
||||||
|
+++ b/lib/xmlparse.c
|
||||||
|
@@ -5372,7 +5372,7 @@ doProlog(XML_Parser parser, const ENCODING *enc, const char *s, const char *end,
|
||||||
|
if (dtd->in_eldecl) {
|
||||||
|
ELEMENT_TYPE *el;
|
||||||
|
const XML_Char *name;
|
||||||
|
- int nameLen;
|
||||||
|
+ size_t nameLen;
|
||||||
|
const char *nxt
|
||||||
|
= (quant == XML_CQUANT_NONE ? next : next - enc->minBytesPerChar);
|
||||||
|
int myindex = nextScaffoldPart(parser);
|
||||||
|
@@ -5388,7 +5388,13 @@ doProlog(XML_Parser parser, const ENCODING *enc, const char *s, const char *end,
|
||||||
|
nameLen = 0;
|
||||||
|
for (; name[nameLen++];)
|
||||||
|
;
|
||||||
|
- dtd->contentStringLen += nameLen;
|
||||||
|
+
|
||||||
|
+ /* Detect and prevent integer overflow */
|
||||||
|
+ if (nameLen > UINT_MAX - dtd->contentStringLen) {
|
||||||
|
+ return XML_ERROR_NO_MEMORY;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ dtd->contentStringLen += (unsigned)nameLen;
|
||||||
|
if (parser->m_elementDeclHandler)
|
||||||
|
handleDefault = XML_FALSE;
|
||||||
|
}
|
||||||
@@ -10,13 +10,14 @@ VERSION_TAG = "${@d.getVar('PV').replace('.', '_')}"
|
|||||||
|
|
||||||
SRC_URI = "https://github.com/libexpat/libexpat/releases/download/R_${VERSION_TAG}/expat-${PV}.tar.bz2 \
|
SRC_URI = "https://github.com/libexpat/libexpat/releases/download/R_${VERSION_TAG}/expat-${PV}.tar.bz2 \
|
||||||
file://libtool-tag.patch \
|
file://libtool-tag.patch \
|
||||||
file://run-ptest \
|
file://run-ptest \
|
||||||
file://0001-Add-output-of-tests-result.patch \
|
file://0001-Add-output-of-tests-result.patch \
|
||||||
file://CVE-2022-22822-27.patch \
|
file://CVE-2022-22822-27.patch \
|
||||||
file://CVE-2021-45960.patch \
|
file://CVE-2021-45960.patch \
|
||||||
file://CVE-2021-46143.patch \
|
file://CVE-2021-46143.patch \
|
||||||
file://CVE-2022-23852.patch \
|
file://CVE-2022-23852.patch \
|
||||||
"
|
file://CVE-2022-23990.patch \
|
||||||
|
"
|
||||||
|
|
||||||
UPSTREAM_CHECK_URI = "https://github.com/libexpat/libexpat/releases/"
|
UPSTREAM_CHECK_URI = "https://github.com/libexpat/libexpat/releases/"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user