Skip to content

Commit

Permalink
fix: reject zero-length idna inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis authored and santigimeno committed Feb 7, 2024
1 parent 0f2d7e7 commit 3530bcc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/idna.c
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions test/test-idna.c
Expand Up @@ -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;
Expand Down

0 comments on commit 3530bcc

Please sign in to comment.