ubeddulla opened a new pull request, #3434:
URL: https://github.com/apache/brpc/pull/3434
SplitHostAndPort parses the port from a URL or Host header by accumulating
digits into a uint64 and narrowing the result with static_cast<int>, with no
range check, so a value above INT_MAX silently wraps to a valid-looking but
wrong port (":4294967377" becomes 81) and a long run of digits overflows the
accumulator. str2endpoint and hostname2endpoint already reject ports outside
0-65535, so this stops accumulating past the range and maps any out-of-range
value to -1 to keep the URL parser consistent with them. The added regression
test in brpc_uri_unittest.cpp covers the wraparound, the just-over-limit case,
a very long digit run, and the Host header path.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]