Skip to content

Commit 3d27175

Browse files
santigimenomarco-ippolito
authored andcommittedFeb 12, 2024
deps: fix GHSA-f74f-cvh7-c6q6/CVE-2024-24806
Refs: GHSA-f74f-cvh7-c6q6 PR-URL: #51614
1 parent 331558b commit 3d27175

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed
 

‎deps/uv/src/idna.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ long uv__idna_toascii(const char* s, const char* se, char* d, char* de) {
274274
char* ds;
275275
int rc;
276276

277+
if (s == se)
278+
return UV_EINVAL;
279+
277280
ds = d;
278281

279282
si = s;
@@ -308,8 +311,9 @@ long uv__idna_toascii(const char* s, const char* se, char* d, char* de) {
308311
return rc;
309312
}
310313

311-
if (d < de)
312-
*d++ = '\0';
314+
if (d >= de)
315+
return UV_EINVAL;
313316

317+
*d++ = '\0';
314318
return d - ds; /* Number of bytes written. */
315319
}

‎deps/uv/test/test-idna.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ TEST_IMPL(utf8_decode1) {
9999
TEST_IMPL(utf8_decode1_overrun) {
100100
const char* p;
101101
char b[1];
102+
char c[1];
102103

103104
/* Single byte. */
104105
p = b;
@@ -112,6 +113,10 @@ TEST_IMPL(utf8_decode1_overrun) {
112113
ASSERT_EQ((unsigned) -1, uv__utf8_decode1(&p, b + 1));
113114
ASSERT_EQ(p, b + 1);
114115

116+
b[0] = 0x7F;
117+
ASSERT_EQ(UV_EINVAL, uv__idna_toascii(b, b + 0, c, c + 1));
118+
ASSERT_EQ(UV_EINVAL, uv__idna_toascii(b, b + 1, c, c + 1));
119+
115120
return 0;
116121
}
117122

@@ -145,8 +150,8 @@ TEST_IMPL(idna_toascii) {
145150
/* Illegal inputs. */
146151
F("\xC0\x80\xC1\x80", UV_EINVAL); /* Overlong UTF-8 sequence. */
147152
F("\xC0\x80\xC1\x80.com", UV_EINVAL); /* Overlong UTF-8 sequence. */
153+
F("", UV_EINVAL);
148154
/* No conversion. */
149-
T("", "");
150155
T(".", ".");
151156
T(".com", ".com");
152157
T("example", "example");

1 commit comments

Comments
 (1)

richardlau commented on Feb 15, 2024

@richardlau
Member

PR-URL should have been #51702

Please sign in to comment.