Skip to content

Commit fe47a61

Browse files
committed
completed the commit
1 parent e15d40f commit fe47a61

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/url_pattern_helpers.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,10 @@ tl::expected<std::string, errors> canonicalize_port(
341341
} else if (digits_to_parse.size() > 5) {
342342
return tl::unexpected(errors::type_error);
343343
}
344+
if(digits_to_parse[0] == '0' && digits_to_parse.size() > 1) {
345+
// Leading zeros are not allowed for multi-digit ports
346+
return tl::unexpected(errors::type_error);
347+
}
344348
// It is valid! Most times, we do not need to parse it into an integer.
345349
return std::string(digits_to_parse);
346350
}

0 commit comments

Comments
 (0)