diff --git a/backport-CVE-2025-6021.patch b/backport-CVE-2025-6021.patch new file mode 100644 index 0000000000000000000000000000000000000000..91d7b567d2f17f18920cb5e923c31c3639759631 --- /dev/null +++ b/backport-CVE-2025-6021.patch @@ -0,0 +1,47 @@ +From acbbeef9f5dcdcc901c5f3fa14d583ef8cfd22f0 Mon Sep 17 00:00:00 2001 +From: Nick Wellnhofer +Date: Tue, 27 May 2025 12:53:17 +0200 +Subject: [PATCH] tree: Fix integer overflow in xmlBuildQName + +This issue affects memory safety and might receive a CVE ID later. + +Fixes #926. +--- + tree.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/tree.c b/tree.c +index 8910dd8..e207f12 100644 +--- a/tree.c ++++ b/tree.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + + #ifdef LIBXML_ZLIB_ENABLED + #include +@@ -221,16 +222,18 @@ xmlGetParameterEntityFromDtd(const xmlDtd *dtd, const xmlChar *name) { + xmlChar * + xmlBuildQName(const xmlChar *ncname, const xmlChar *prefix, + xmlChar *memory, int len) { +- int lenn, lenp; ++ size_t lenn, lenp; + xmlChar *ret; + +- if (ncname == NULL) return(NULL); ++ if ((ncname == NULL) || (len < 0)) return(NULL); + if (prefix == NULL) return((xmlChar *) ncname); + + lenn = strlen((char *) ncname); + lenp = strlen((char *) prefix); ++ if (lenn >= SIZE_MAX - lenp - 1) ++ return(NULL); + +- if ((memory == NULL) || (len < lenn + lenp + 2)) { ++ if ((memory == NULL) || ((size_t) len < lenn + lenp + 2)) { + ret = (xmlChar *) xmlMallocAtomic(lenn + lenp + 2); + if (ret == NULL) { + xmlTreeErrMemory("building QName"); + diff --git a/libxml2.spec b/libxml2.spec index 4497ea275df9dbc5a4c0ed5f4f6e61f5f8180641..2a112d2c1eb6e989d61062287191d32417b2f38e 100644 --- a/libxml2.spec +++ b/libxml2.spec @@ -1,7 +1,7 @@ Summary: Library providing XML and HTML support Name: libxml2 Version: 2.11.9 -Release: 3 +Release: 4 License: MIT Group: Development/Libraries Source: https://download.gnome.org/sources/%{name}/2.11/%{name}-%{version}.tar.xz @@ -15,6 +15,7 @@ Patch5: backport-CVE-2025-24928.patch Patch6: backport-CVE-2025-27113.patch Patch7: backport-CVE-2025-32414.patch Patch8: backport-CVE-2025-32415.patch +Patch9: backport-CVE-2025-6021.patch BuildRequires: python3-devel BuildRequires: zlib-devel @@ -152,6 +153,9 @@ gzip -9 -c doc/libxml2-api.xml > doc/libxml2-api.xml.gz %changelog +* Sat Jun 14 2025 Funda Wang - 2.11.9-4 +- fix CVE-2025-6021 + * Mon Apr 14 2025 Funda Wang - 2.11.9-3 - fix CVE-2025-32414, CVE-2025-32415