Skip to content

Commit

Permalink
deps: fix GHSA-f74f-cvh7-c6q6/CVE-2024-24806
Browse files Browse the repository at this point in the history
Refs: GHSA-f74f-cvh7-c6q6

PR-URL: #51737
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
CVE-ID: CVE-2024-24806
  • Loading branch information
santigimeno authored and RafaelGSS committed Feb 13, 2024
1 parent 3f6addd commit 186a6e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 6 additions & 2 deletions deps/uv/src/idna.c
Expand Up @@ -274,6 +274,9 @@ long 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 Expand Up @@ -308,8 +311,9 @@ long uv__idna_toascii(const char* s, const char* se, char* d, char* de) {
return rc;
}

if (d < de)
*d++ = '\0';
if (d >= de)
return UV_EINVAL;

*d++ = '\0';
return d - ds; /* Number of bytes written. */
}
7 changes: 6 additions & 1 deletion deps/uv/test/test-idna.c
Expand Up @@ -99,6 +99,7 @@ TEST_IMPL(utf8_decode1) {
TEST_IMPL(utf8_decode1_overrun) {
const char* p;
char b[1];
char c[1];

/* Single byte. */
p = b;
Expand All @@ -112,6 +113,10 @@ TEST_IMPL(utf8_decode1_overrun) {
ASSERT_EQ((unsigned) -1, uv__utf8_decode1(&p, b + 1));
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 Expand Up @@ -145,8 +150,8 @@ TEST_IMPL(idna_toascii) {
/* Illegal inputs. */
F("\xC0\x80\xC1\x80", UV_EINVAL); /* Overlong UTF-8 sequence. */
F("\xC0\x80\xC1\x80.com", UV_EINVAL); /* Overlong UTF-8 sequence. */
F("", UV_EINVAL);
/* No conversion. */
T("", "");
T(".", ".");
T(".com", ".com");
T("example", "example");
Expand Down

0 comments on commit 186a6e1

Please sign in to comment.