Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

url: revert "validate ipv4 part length" #42940

Merged
merged 2 commits into from May 5, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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