代码拉取完成,页面将自动刷新
From 3530bcc30350d4a6ccf35d2f7b33e23292b9de70 Mon Sep 17 00:00:00 2001
From: Ben Noordhuis <[email protected]>
Date: Thu, 18 Jan 2024 14:52:38 +0100
Subject: [PATCH] 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(+)
diff --git a/src/idna.c b/src/idna.c
index 4638546d020..efc5f283ce2 100644
--- a/src/idna.c
+++ b/src/idna.c
@@ -322,6 +322,9 @@ ssize_t uv__idna_toascii(const char* s, const char* se, char* d, char* de) {
char* ds;
int rc;
+ if (s == se)
+ return UV_EINVAL;
+
ds = d;
si = s;
diff --git a/test/test-idna.c b/test/test-idna.c
index 5f8d696a7f0..3c4820f7659 100644
--- a/test/test-idna.c
+++ b/test/test-idna.c
@@ -115,6 +115,7 @@ TEST_IMPL(utf8_decode1_overrun) {
ASSERT_PTR_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;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。