diff options
-rw-r--r-- | meta/recipes-core/libxml/libxml2/CVE-2025-6021.patch | 56 | ||||
-rw-r--r-- | meta/recipes-core/libxml/libxml2_2.12.10.bb | 1 |
2 files changed, 57 insertions, 0 deletions
diff --git a/meta/recipes-core/libxml/libxml2/CVE-2025-6021.patch b/meta/recipes-core/libxml/libxml2/CVE-2025-6021.patch new file mode 100644 index 0000000000..e28a9edb74 --- /dev/null +++ b/meta/recipes-core/libxml/libxml2/CVE-2025-6021.patch | |||
@@ -0,0 +1,56 @@ | |||
1 | From acbbeef9f5dcdcc901c5f3fa14d583ef8cfd22f0 Mon Sep 17 00:00:00 2001 | ||
2 | From: Nick Wellnhofer <wellnhofer@aevum.de> | ||
3 | Date: Tue, 27 May 2025 12:53:17 +0200 | ||
4 | Subject: [PATCH] tree: Fix integer overflow in xmlBuildQName | ||
5 | |||
6 | This issue affects memory safety. | ||
7 | |||
8 | Fixes #926. | ||
9 | |||
10 | Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/acbbeef9f5dcdcc901c5f3fa14d583ef8cfd22f0] | ||
11 | CVE: CVE-2025-6021 | ||
12 | Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com> | ||
13 | --- | ||
14 | tree.c | 12 +++++++++--- | ||
15 | 1 file changed, 9 insertions(+), 3 deletions(-) | ||
16 | |||
17 | diff --git a/tree.c b/tree.c | ||
18 | index dc3ac4f..f89e3cd 100644 | ||
19 | --- a/tree.c | ||
20 | +++ b/tree.c | ||
21 | @@ -47,6 +47,10 @@ | ||
22 | #include "private/error.h" | ||
23 | #include "private/tree.h" | ||
24 | |||
25 | +#ifndef SIZE_MAX | ||
26 | +#define SIZE_MAX ((size_t) -1) | ||
27 | +#endif | ||
28 | + | ||
29 | int __xmlRegisterCallbacks = 0; | ||
30 | |||
31 | /************************************************************************ | ||
32 | @@ -216,16 +220,18 @@ xmlGetParameterEntityFromDtd(const xmlDtd *dtd, const xmlChar *name) { | ||
33 | xmlChar * | ||
34 | xmlBuildQName(const xmlChar *ncname, const xmlChar *prefix, | ||
35 | xmlChar *memory, int len) { | ||
36 | - int lenn, lenp; | ||
37 | + size_t lenn, lenp; | ||
38 | xmlChar *ret; | ||
39 | |||
40 | - if (ncname == NULL) return(NULL); | ||
41 | + if ((ncname == NULL) || (len < 0)) return(NULL); | ||
42 | if (prefix == NULL) return((xmlChar *) ncname); | ||
43 | |||
44 | lenn = strlen((char *) ncname); | ||
45 | lenp = strlen((char *) prefix); | ||
46 | + if (lenn >= SIZE_MAX - lenp - 1) | ||
47 | + return(NULL); | ||
48 | |||
49 | - if ((memory == NULL) || (len < lenn + lenp + 2)) { | ||
50 | + if ((memory == NULL) || ((size_t) len < lenn + lenp + 2)) { | ||
51 | ret = (xmlChar *) xmlMallocAtomic(lenn + lenp + 2); | ||
52 | if (ret == NULL) { | ||
53 | xmlTreeErrMemory("building QName"); | ||
54 | -- | ||
55 | 2.49.0 | ||
56 | |||
diff --git a/meta/recipes-core/libxml/libxml2_2.12.10.bb b/meta/recipes-core/libxml/libxml2_2.12.10.bb index 2eea65732b..1ecac70b4c 100644 --- a/meta/recipes-core/libxml/libxml2_2.12.10.bb +++ b/meta/recipes-core/libxml/libxml2_2.12.10.bb | |||
@@ -20,6 +20,7 @@ SRC_URI += "http://www.w3.org/XML/Test/xmlts20130923.tar;subdir=${BP};name=testt | |||
20 | file://install-tests.patch \ | 20 | file://install-tests.patch \ |
21 | file://CVE-2025-32414.patch \ | 21 | file://CVE-2025-32414.patch \ |
22 | file://CVE-2025-32415.patch \ | 22 | file://CVE-2025-32415.patch \ |
23 | file://CVE-2025-6021.patch \ | ||
23 | " | 24 | " |
24 | 25 | ||
25 | SRC_URI[archive.sha256sum] = "c3d8c0c34aa39098f66576fe51969db12a5100b956233dc56506f7a8679be995" | 26 | SRC_URI[archive.sha256sum] = "c3d8c0c34aa39098f66576fe51969db12a5100b956233dc56506f7a8679be995" |