diff --git a/CVE-2025-6021.patch b/CVE-2025-6021.patch new file mode 100644 index 0000000000000000000000000000000000000000..91d7b567d2f17f18920cb5e923c31c3639759631 --- /dev/null +++ b/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 11b82c02104c64e290c6dd7eacd891cf149717db..e3586b9c20caaa32e41163e588fec0cba27be7a0 100644 --- a/libxml2.spec +++ b/libxml2.spec @@ -1,14 +1,15 @@ Summary: Library providing XML and HTML support Name: libxml2 Version: 2.12.10 -Release: 2 +Release: 3 License: MIT Group: Development/Libraries -Source: https://download.gnome.org/sources/%{name}/2.11/%{name}-%{version}.tar.xz +Source: https://download.gnome.org/sources/%{name}/2.12/%{name}-%{version}.tar.xz Patch0: libxml2-multilib.patch Patch6001: CVE-2025-32414.patch Patch6002: CVE-2025-32415.patch +Patch6003: CVE-2025-6021.patch BuildRequires: pkgconfig(liblzma) BuildRequires: pkgconfig(python3) @@ -128,6 +129,9 @@ gzip -9 -c doc/libxml2-api.xml > doc/libxml2-api.xml.gz %changelog +* Sat Jun 14 2025 Funda Wang - 2.12.10-3 +- fix CVE-2025-6021 + * Mon Apr 14 2025 Funda Wang - 2.12.10-2 - fix CVE-2025-32414, CVE-2025-32415