From: Peter Marko <peter.ma...@siemens.com>

Pick commit fomr 2.12 branch.

Signed-off-by: Peter Marko <peter.ma...@siemens.com>
Signed-off-by: Steve Sakoman <st...@sakoman.com>
---
 .../libxml/libxml2/CVE-2025-24928.patch       | 58 +++++++++++++++++++
 meta/recipes-core/libxml/libxml2_2.9.14.bb    |  1 +
 2 files changed, 59 insertions(+)
 create mode 100644 meta/recipes-core/libxml/libxml2/CVE-2025-24928.patch

diff --git a/meta/recipes-core/libxml/libxml2/CVE-2025-24928.patch 
b/meta/recipes-core/libxml/libxml2/CVE-2025-24928.patch
new file mode 100644
index 0000000000..6da43f81a5
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/CVE-2025-24928.patch
@@ -0,0 +1,58 @@
+From 858ca26c0689161a6b903a6682cc8a1cc10a0ea8 Mon Sep 17 00:00:00 2001
+From: Nick Wellnhofer <wellnho...@aevum.de>
+Date: Tue, 11 Feb 2025 17:30:40 +0100
+Subject: [PATCH] [CVE-2025-24928] Fix stack-buffer-overflow in
+ xmlSnprintfElements
+
+Fixes #847.
+
+CVE: CVE-2025-24928
+Upstream-Status: Backport 
[https://gitlab.gnome.org/GNOME/libxml2/-/commit/858ca26c0689161a6b903a6682cc8a1cc10a0ea8]
+Signed-off-by: Peter Marko <peter.ma...@siemens.com>
+---
+ valid.c | 25 +++++++++++++------------
+ 1 file changed, 13 insertions(+), 12 deletions(-)
+
+diff --git a/valid.c b/valid.c
+index ed3c8503..36a0435b 100644
+--- a/valid.c
++++ b/valid.c
+@@ -5259,25 +5259,26 @@ xmlSnprintfElements(char *buf, int size, xmlNodePtr 
node, int glob) {
+           return;
+       }
+         switch (cur->type) {
+-            case XML_ELEMENT_NODE:
++            case XML_ELEMENT_NODE: {
++                int qnameLen = xmlStrlen(cur->name);
++
++                if ((cur->ns != NULL) && (cur->ns->prefix != NULL))
++                    qnameLen += xmlStrlen(cur->ns->prefix) + 1;
++                if (size - len < qnameLen + 10) {
++                    if ((size - len > 4) && (buf[len - 1] != '.'))
++                        strcat(buf, " ...");
++                    return;
++                }
+               if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
+-                  if (size - len < xmlStrlen(cur->ns->prefix) + 10) {
+-                      if ((size - len > 4) && (buf[len - 1] != '.'))
+-                          strcat(buf, " ...");
+-                      return;
+-                  }
+                   strcat(buf, (char *) cur->ns->prefix);
+                   strcat(buf, ":");
+               }
+-                if (size - len < xmlStrlen(cur->name) + 10) {
+-                  if ((size - len > 4) && (buf[len - 1] != '.'))
+-                      strcat(buf, " ...");
+-                  return;
+-              }
+-              strcat(buf, (char *) cur->name);
++                if (cur->name != NULL)
++                  strcat(buf, (char *) cur->name);
+               if (cur->next != NULL)
+                   strcat(buf, " ");
+               break;
++            }
+             case XML_TEXT_NODE:
+               if (xmlIsBlankNode(cur))
+                   break;
diff --git a/meta/recipes-core/libxml/libxml2_2.9.14.bb 
b/meta/recipes-core/libxml/libxml2_2.9.14.bb
index e9578ceb59..8f1d882505 100644
--- a/meta/recipes-core/libxml/libxml2_2.9.14.bb
+++ b/meta/recipes-core/libxml/libxml2_2.9.14.bb
@@ -36,6 +36,7 @@ SRC_URI += 
"http://www.w3.org/XML/Test/xmlts20080827.tar;subdir=${BP};name=testt
            file://CVE-2022-49043.patch \
            file://0001-pattern-Fix-compilation-of-explicit-child-axis.patch \
            file://CVE-2024-56171.patch \
+           file://CVE-2025-24928.patch \
            "
 
 SRC_URI[archive.sha256sum] = 
"60d74a257d1ccec0475e749cba2f21559e48139efba6ff28224357c7c798dfee"
-- 
2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#211898): 
https://lists.openembedded.org/g/openembedded-core/message/211898
Mute This Topic: https://lists.openembedded.org/mt/111377460/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to