Skip to content

Commit

Permalink
url: revert "validate ipv4 part length"
Browse files Browse the repository at this point in the history
This reverts commit 87d0d7a.

Refs: nodejs#42915
  • Loading branch information
aduh95 committed May 2, 2022
1 parent 1d8a320 commit 05dcc02
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
5 changes: 1 addition & 4 deletions src/node_url.cc
Expand Up @@ -411,11 +411,8 @@ void URLHost::ParseIPv4Host(const char* input, size_t length, bool* is_ipv4) {
const char ch = pointer < end ? pointer[0] : kEOL;
int64_t remaining = end - pointer - 1;
if (ch == '.' || ch == kEOL) {
// If parts’s size is greater than 4, validation error, return failure.
if (++parts > static_cast<int>(arraysize(numbers))) {
*is_ipv4 = true;
if (++parts > static_cast<int>(arraysize(numbers)))
return;
}
if (pointer == mark)
return;
int64_t n = ParseNumber(mark, pointer);
Expand Down
17 changes: 11 additions & 6 deletions test/fixtures/wpt/url/resources/urltestdata.json
Expand Up @@ -5317,12 +5317,17 @@
{
"input": "http://256.256.256.256.256",
"base": "http://other.com/",
"failure": true
},
{
"input": "http://256.256.256.256.256.",
"base": "http://other.com/",
"failure": true
"href": "http://256.256.256.256.256/",
"origin": "http://256.256.256.256.256",
"protocol": "http:",
"username": "",
"password": "",
"host": "256.256.256.256.256",
"hostname": "256.256.256.256.256",
"port": "",
"pathname": "/",
"search": "",
"hash": ""
},
{
"input": "https://0x.0x.0",
Expand Down

0 comments on commit 05dcc02

Please sign in to comment.