summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/libuv/libuv/CVE-2024-24806-1.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/libuv/libuv/CVE-2024-24806-1.patch')
-rw-r--r--meta/recipes-connectivity/libuv/libuv/CVE-2024-24806-1.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/libuv/libuv/CVE-2024-24806-1.patch b/meta/recipes-connectivity/libuv/libuv/CVE-2024-24806-1.patch
new file mode 100644
index 0000000000..d263cced8d
--- /dev/null
+++ b/meta/recipes-connectivity/libuv/libuv/CVE-2024-24806-1.patch
@@ -0,0 +1,56 @@
+From b8ee33667d265b936d60ee7f0ba0b22463ccb019 Mon Sep 17 00:00:00 2001
+From: Ben Noordhuis <info@bnoordhuis.nl>
+Date: Thu, 18 Jan 2024 14:51:40 +0100
+Subject: [PATCH] fix: always zero-terminate idna output
+
+Upstream-Status: Backport [https://github.com/libuv/libuv/commit/0f2d7e784a256b54b2385043438848047bc2a629]
+CVE: CVE-2024-24806
+
+Fixes: https://github.com/libuv/libuv/security/advisories/GHSA-f74f-cvh7-c6q6
+Signed-off-by: Hugo SIMELIERE <hsimeliere.opensource@witekio.com>
+---
+ src/idna.c | 5 +++--
+ test/test-idna.c | 4 ++++
+ 2 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/src/idna.c b/src/idna.c
+index 93d982ca..ce7f2746 100644
+--- a/src/idna.c
++++ b/src/idna.c
+@@ -308,8 +308,9 @@ long uv__idna_toascii(const char* s, const char* se, char* d, char* de) {
+ return rc;
+ }
+
+- if (d < de)
+- *d++ = '\0';
++ if (d >= de)
++ return UV_EINVAL;
+
++ *d++ = '\0';
+ return d - ds; /* Number of bytes written. */
+ }
+diff --git a/test/test-idna.c b/test/test-idna.c
+index f4fad965..d079be55 100644
+--- a/test/test-idna.c
++++ b/test/test-idna.c
+@@ -99,6 +99,7 @@ TEST_IMPL(utf8_decode1) {
+ TEST_IMPL(utf8_decode1_overrun) {
+ const char* p;
+ char b[1];
++ char c[1];
+
+ /* Single byte. */
+ p = b;
+@@ -112,6 +113,9 @@ TEST_IMPL(utf8_decode1_overrun) {
+ ASSERT_EQ((unsigned) -1, uv__utf8_decode1(&p, b + 1));
+ ASSERT_EQ(p, b + 1);
+
++ b[0] = 0x7F;
++ ASSERT_EQ(UV_EINVAL, uv__idna_toascii(b, b + 1, c, c + 1));
++
+ return 0;
+ }
+
+--
+2.43.0
+