mirror of
https://git.yoctoproject.org/poky
synced 2026-10-21 18:58:20 +00:00
libxml2: Fix CVE-2026-86140
This patch applies the upstream fix as referenced in [2], using the commit shown in [1]. [1] https://github.com/GNOME/libxml2/commit/d1686f91dbda141a752200419d35639fd6b38340 [2] https://nvd.nist.gov/vuln/detail/CVE-2026-86140 (From OE-Core rev: 2c45b60e5d543bca0c1a239254d879d1ad7e3a72) Signed-off-by: Hetvi Thakar <hthakar@cisco.com> Signed-off-by: Yoann Congal <yoann.congal@smile.fr> Signed-off-by: Paul Barker <paul@pbarker.dev>
This commit is contained in:
1 parent
0a97d1e900
commit
b986a051b0
2 files changed
+57
No files matched your search
@@ -0,0 +1,56 @@
|
||||
From 7d324fcfa71e8567678ad254c0e10e509ebae99b Mon Sep 17 00:00:00 2001
|
||||
From: mohammadmseet-hue <mohammadmseet@gmail.com>
|
||||
Date: Thu, 16 Apr 2026 02:54:37 +0200
|
||||
Subject: [PATCH] fix: add bounds checks to xmlSnprintfElements in valid.c
|
||||
|
||||
CVE-2025-24928 fixed xmlSnprintfElementContent for unchecked strcat()
|
||||
writes, but the sibling function xmlSnprintfElements has the identical
|
||||
unfixed pattern. The strcat(buf, "(") before the while loop and
|
||||
strcat(buf, ")") after the loop exit have no bounds checks.
|
||||
|
||||
Add remaining-space checks before both strcat calls, with early return
|
||||
and ellipsis when space is insufficient.
|
||||
|
||||
CVE: CVE-2026-86140
|
||||
Upstream-Status: Backport [https://github.com/GNOME/libxml2/commit/d1686f91dbda141a752200419d35639fd6b38340]
|
||||
|
||||
(cherry picked from commit d1686f91dbda141a752200419d35639fd6b38340)
|
||||
Signed-off-by: Hetvi Thakar <hthakar@cisco.com>
|
||||
---
|
||||
valid.c | 16 ++++++++++++++--
|
||||
1 file changed, 14 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/valid.c b/valid.c
|
||||
index ae4bb822..718e6d85 100644
|
||||
--- a/valid.c
|
||||
+++ b/valid.c
|
||||
@@ -5047,7 +5047,15 @@ xmlSnprintfElements(char *buf, int size, xmlNodePtr node, int glob) {
|
||||
int len;
|
||||
|
||||
if (node == NULL) return;
|
||||
- if (glob) strcat(buf, "(");
|
||||
+ len = strlen(buf);
|
||||
+ if (glob) {
|
||||
+ if (size - len < 50) {
|
||||
+ if ((size - len > 4) && (buf[len - 1] != '.'))
|
||||
+ strcat(buf, " ...");
|
||||
+ return;
|
||||
+ }
|
||||
+ strcat(buf, "(");
|
||||
+ }
|
||||
cur = node;
|
||||
while (cur != NULL) {
|
||||
len = strlen(buf);
|
||||
@@ -5111,7 +5119,11 @@ xmlSnprintfElements(char *buf, int size, xmlNodePtr node, int glob) {
|
||||
}
|
||||
cur = cur->next;
|
||||
}
|
||||
- if (glob) strcat(buf, ")");
|
||||
+ if (glob) {
|
||||
+ len = strlen(buf);
|
||||
+ if (size - len > 1)
|
||||
+ strcat(buf, ")");
|
||||
+ }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,6 +34,7 @@ SRC_URI += "http://www.w3.org/XML/Test/xmlts20130923.tar;subdir=${BP};name=testt
|
||||
file://CVE-2026-11979.patch \
|
||||
file://CVE-2026-86137.patch \
|
||||
file://CVE-2026-86138.patch \
|
||||
file://CVE-2026-86140.patch \
|
||||
"
|
||||
|
||||
SRC_URI[archive.sha256sum] = "c3d8c0c34aa39098f66576fe51969db12a5100b956233dc56506f7a8679be995"
|
||||
|
||||
Reference in new issue
Block a user