* [Buildroot] [PATCH 1/1] package/libxml2: fix CVE-2020-24977
@ 2020-09-14 21:06 Fabrice Fontaine
2020-09-19 20:16 ` Thomas Petazzoni
2020-09-29 14:19 ` Peter Korsgaard
0 siblings, 2 replies; 3+ messages in thread
From: Fabrice Fontaine @ 2020-09-14 21:06 UTC (permalink / raw)
To: buildroot
GNOME project libxml2 v2.9.10 and earlier have a global Buffer Overflow
vulnerability in xmlEncodeEntitiesInternal at libxml2/entities.c.
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
...of-bounds-read-with-xmllint--htmlout.patch | 40 +++++++++++++++++++
package/libxml2/libxml2.mk | 2 +
2 files changed, 42 insertions(+)
create mode 100644 package/libxml2/0003-Fix-out-of-bounds-read-with-xmllint--htmlout.patch
diff --git a/package/libxml2/0003-Fix-out-of-bounds-read-with-xmllint--htmlout.patch b/package/libxml2/0003-Fix-out-of-bounds-read-with-xmllint--htmlout.patch
new file mode 100644
index 0000000000..460f2a3ae6
--- /dev/null
+++ b/package/libxml2/0003-Fix-out-of-bounds-read-with-xmllint--htmlout.patch
@@ -0,0 +1,40 @@
+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.
+
+[Retrieved from:
+https://gitlab.gnome.org/GNOME/libxml2/-/commit/50f06b3efb638efb0abd95dc62dca05ae67882c2]
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ xmllint.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/xmllint.c b/xmllint.c
+index f6a8e4636..c647486f3 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);
+--
+GitLab
+
diff --git a/package/libxml2/libxml2.mk b/package/libxml2/libxml2.mk
index acbdfb7728..e9379b05ae 100644
--- a/package/libxml2/libxml2.mk
+++ b/package/libxml2/libxml2.mk
@@ -13,6 +13,8 @@ LIBXML2_LICENSE_FILES = COPYING
LIBXML2_IGNORE_CVES += CVE-2020-7595
# 0002-Fix-memory-leak-in-xmlSchemaValidateStream.patch
LIBXML2_IGNORE_CVES += CVE-2019-20388
+# 0003-Fix-out-of-bounds-read-with-xmllint--htmlout.patch
+LIBXML2_IGNORE_CVES += CVE-2020-24977
LIBXML2_CONFIG_SCRIPTS = xml2-config
# relocation truncated to fit: R_68K_GOT16O
--
2.28.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH 1/1] package/libxml2: fix CVE-2020-24977
2020-09-14 21:06 [Buildroot] [PATCH 1/1] package/libxml2: fix CVE-2020-24977 Fabrice Fontaine
@ 2020-09-19 20:16 ` Thomas Petazzoni
2020-09-29 14:19 ` Peter Korsgaard
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2020-09-19 20:16 UTC (permalink / raw)
To: buildroot
On Mon, 14 Sep 2020 23:06:44 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
> GNOME project libxml2 v2.9.10 and earlier have a global Buffer Overflow
> vulnerability in xmlEncodeEntitiesInternal at libxml2/entities.c.
>
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
> ...of-bounds-read-with-xmllint--htmlout.patch | 40 +++++++++++++++++++
> package/libxml2/libxml2.mk | 2 +
> 2 files changed, 42 insertions(+)
> create mode 100644 package/libxml2/0003-Fix-out-of-bounds-read-with-xmllint--htmlout.patch
Applied to master, thanks.
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH 1/1] package/libxml2: fix CVE-2020-24977
2020-09-14 21:06 [Buildroot] [PATCH 1/1] package/libxml2: fix CVE-2020-24977 Fabrice Fontaine
2020-09-19 20:16 ` Thomas Petazzoni
@ 2020-09-29 14:19 ` Peter Korsgaard
1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2020-09-29 14:19 UTC (permalink / raw)
To: buildroot
>>>>> "Fabrice" == Fabrice Fontaine <fontaine.fabrice@gmail.com> writes:
> GNOME project libxml2 v2.9.10 and earlier have a global Buffer Overflow
> vulnerability in xmlEncodeEntitiesInternal at libxml2/entities.c.
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Committed to 2020.02.x, 2020.05.x and 2020.08.x, thanks.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-29 14:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-14 21:06 [Buildroot] [PATCH 1/1] package/libxml2: fix CVE-2020-24977 Fabrice Fontaine
2020-09-19 20:16 ` Thomas Petazzoni
2020-09-29 14:19 ` Peter Korsgaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox