init: Reject + sign in -*port parsing

It would be confusing to specify the sign for an unsigned value here, so
reject it.
This commit is contained in:
MarcoFalke 2025-05-15 20:06:32 +02:00
parent fa9c45577d
commit fa89652e68
No known key found for this signature in database

View File

@ -1179,8 +1179,8 @@ bool CheckHostPortOptions(const ArgsManager& args) {
"-rpcport",
}) {
if (const auto port{args.GetArg(port_option)}) {
uint16_t n;
if (!ParseUInt16(*port, &n) || n == 0) {
const auto n{ToIntegral<uint16_t>(*port)};
if (!n || *n == 0) {
return InitError(InvalidPortErrMsg(port_option, *port));
}
}