Skip to content

Commit

Permalink
centralize port validation logic into parse_port
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcanaltin committed Jan 5, 2025
1 parent 8574c1f commit 9a6637e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/ada/url_aggregator-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,13 @@ ada_really_inline size_t url_aggregator::parse_port(
return 0;
}
ada_log("parse_port: ", parsed_port);

if (parsed_port < 1 || parsed_port > 65535) {
ada_log("parse_port: port out of valid range (1-65535)");
is_valid = false;
return 0;
}

const size_t consumed = size_t(r.ptr - view.data());
ada_log("parse_port: consumed ", consumed);
if (check_trailing_content) {
Expand Down

0 comments on commit 9a6637e

Please sign in to comment.