mirror of
https://git.yoctoproject.org/poky
synced 2026-02-13 20:23:04 +01:00
GNOME project libxml2 v2.9.10 and earlier have a global Buffer Overflow
vulnerability in xmlEncodeEntitiesInternal at libxml2/entities.c. The issue has
been fixed in commit 8e7c20a1 (20910-GITv2.9.10-103-g8e7c20a1).
Reference:
https://gitlab.gnome.org/GNOME/libxml2/-/issues/178
Upstream patch:
50f06b3efb
(From OE-Core rev: d5406b389fcae8fb0f5fc9cc7dbf7ee819c04bc8)
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 92dc02b8f03f3586de0a2ec1463b189a3918e303)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
42 lines
1.2 KiB
Diff
42 lines
1.2 KiB
Diff
From 50f06b3efb638efb0abd95dc62dca05ae67882c2 Mon Sep 17 00:00:00 2001
|
|
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
|
Date: Fri, 7 Aug 2020 21:54:27 +0200
|
|
Subject: [PATCH] Fix out-of-bounds read with 'xmllint --htmlout'
|
|
|
|
Make sure that truncated UTF-8 sequences don't cause an out-of-bounds
|
|
array access.
|
|
|
|
Thanks to @SuhwanSong and the Agency for Defense Development (ADD) for
|
|
the report.
|
|
|
|
Fixes #178.
|
|
|
|
CVE: CVE-2020-24977
|
|
Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/50f06b3efb638efb0abd95dc62dca05ae67882c2]
|
|
|
|
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
|
|
---
|
|
xmllint.c | 6 ++++++
|
|
1 file changed, 6 insertions(+)
|
|
|
|
diff --git a/xmllint.c b/xmllint.c
|
|
index f6a8e463..c647486f 100644
|
|
--- a/xmllint.c
|
|
+++ b/xmllint.c
|
|
@@ -528,6 +528,12 @@ static void
|
|
xmlHTMLEncodeSend(void) {
|
|
char *result;
|
|
|
|
+ /*
|
|
+ * xmlEncodeEntitiesReentrant assumes valid UTF-8, but the buffer might
|
|
+ * end with a truncated UTF-8 sequence. This is a hack to at least avoid
|
|
+ * an out-of-bounds read.
|
|
+ */
|
|
+ memset(&buffer[sizeof(buffer)-4], 0, 4);
|
|
result = (char *) xmlEncodeEntitiesReentrant(NULL, BAD_CAST buffer);
|
|
if (result) {
|
|
xmlGenericError(xmlGenericErrorContext, "%s", result);
|
|
--
|
|
2.17.1
|
|
|