libuv/0002-fix-reject-zero-length-idna-inputs.patch

38 lines
1.1 KiB
Diff

From 3530bcc30350d4a6ccf35d2f7b33e23292b9de70 Mon Sep 17 00:00:00 2001
From: Ben Noordhuis <info@bnoordhuis.nl>
Date: Thu, 18 Jan 2024 14:52:38 +0100
Subject: [PATCH 2/3] fix: reject zero-length idna inputs
Fixes: https://github.com/libuv/libuv/security/advisories/GHSA-f74f-cvh7-c6q6
---
src/idna.c | 3 +++
test/test-idna.c | 1 +
2 files changed, 4 insertions(+)
Index: libuv-v1.44.2/src/idna.c
===================================================================
--- libuv-v1.44.2.orig/src/idna.c
+++ libuv-v1.44.2/src/idna.c
@@ -274,6 +274,9 @@ long uv__idna_toascii(const char* s, con
char* ds;
int rc;
+ if (s == se)
+ return UV_EINVAL;
+
ds = d;
si = s;
Index: libuv-v1.44.2/test/test-idna.c
===================================================================
--- libuv-v1.44.2.orig/test/test-idna.c
+++ libuv-v1.44.2/test/test-idna.c
@@ -114,6 +114,7 @@ TEST_IMPL(utf8_decode1_overrun) {
ASSERT_EQ(p, b + 1);
b[0] = 0x7F;
+ ASSERT_EQ(UV_EINVAL, uv__idna_toascii(b, b + 0, c, c + 1));
ASSERT_EQ(UV_EINVAL, uv__idna_toascii(b, b + 1, c, c + 1));
return 0;