From e3f2ad84c721d4d4efa7cc883a83d004cb27b549 Mon Sep 17 00:00:00 2001 From: yangjinlin01 Date: Tue, 17 Jun 2025 17:28:54 +0800 Subject: [PATCH] [CVE] FIX CVE-2025-6021 to #21752 Commit fix cve-2025-6021 Project: TC2024080204 Signed-off-by: yangjinlin01 --- Bugfix-for-CVE-2025-6021.patch | 48 ++++++++++++++++++++++++++++++++++ libxml2.spec | 7 ++++- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 Bugfix-for-CVE-2025-6021.patch diff --git a/Bugfix-for-CVE-2025-6021.patch b/Bugfix-for-CVE-2025-6021.patch new file mode 100644 index 0000000..a185191 --- /dev/null +++ b/Bugfix-for-CVE-2025-6021.patch @@ -0,0 +1,48 @@ +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"); +-- +GitLab diff --git a/libxml2.spec b/libxml2.spec index 3f74efb..04d2bd9 100644 --- a/libxml2.spec +++ b/libxml2.spec @@ -1,4 +1,4 @@ -%define anolis_release 9 +%define anolis_release 10 Name: libxml2 Version: 2.11.5 Release: %{anolis_release}%{?dist} @@ -37,6 +37,8 @@ Patch7: Bugfix-for-CVE-2025-32415.patch Patch8: Bugfix-for-CVE-2024-56171.patch #Upstream fix: https://gitlab.gnome.org/GNOME/libxml2/-/commit/6c716d491dd2e67f08066f4dc0619efeb49e43e6 Patch9: Bugfix-for-CVE-2025-27113.patch +#Upstream fix: https://gitlab.gnome.org/GNOME/libxml2/-/commit/acbbeef9f5dcdcc901c5f3fa14d583ef8cfd22f0 +Patch10: Bugfix-for-CVE-2025-6021.patch BuildRequires: cmake-rpm-macros BuildRequires: gcc @@ -182,6 +184,9 @@ gzip -9 -c doc/libxml2-api.xml > doc/libxml2-api.xml.gz %doc NEWS README.md %changelog +* Tue Jun 17 2025 yangjinlin01 - 2.11.5-10 +- Fix CVE-2025-6021 + * Wed May 14 2025 yangjinlin01 - 2.11.5-9 - Fix CVE-2025-27113 -- Gitee