Skip to content

Commit 3530bcc

Browse files
bnoordhuissantigimeno
authored andcommitted
fix: reject zero-length idna inputs
Fixes: GHSA-f74f-cvh7-c6q6
1 parent 0f2d7e7 commit 3530bcc

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Diff for: src/idna.c

+3
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,9 @@ ssize_t uv__idna_toascii(const char* s, const char* se, char* d, char* de) {
322322
char* ds;
323323
int rc;
324324

325+
if (s == se)
326+
return UV_EINVAL;
327+
325328
ds = d;
326329

327330
si = s;

Diff for: test/test-idna.c

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ TEST_IMPL(utf8_decode1_overrun) {
115115
ASSERT_PTR_EQ(p, b + 1);
116116

117117
b[0] = 0x7F;
118+
ASSERT_EQ(UV_EINVAL, uv__idna_toascii(b, b + 0, c, c + 1));
118119
ASSERT_EQ(UV_EINVAL, uv__idna_toascii(b, b + 1, c, c + 1));
119120

120121
return 0;

0 commit comments

Comments
 (0)