8000 fix: reject zero-length idna inputs · libuv/libuv@3530bcc · GitHub
[go: up one dir, main page]

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

src/idna.c

Lines changed: 3 additions & 0 deletions
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;

test/test-idna.c

Lines changed: 1 addition & 0 deletions
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)
0