mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 20:33:31 +01:00
Check for port config before addr config in client port options
Otherwise, we'll fail, since "9050" looks like a perfectly fine address.
This commit is contained in:
parent
6fa99ab32f
commit
e05ddf3e18
@ -5039,6 +5039,12 @@ parse_client_port_config(smartlist_t *out,
|
||||
tor_free(addrtmp);
|
||||
goto err;
|
||||
}
|
||||
} else {
|
||||
/* Try parsing integer port before address, because, who knows?
|
||||
"9050" might be a valid address. */
|
||||
port = (int) tor_parse_long(addrport, 10, 0, 65535, &ok, NULL);
|
||||
if (ok) {
|
||||
tor_addr_from_str(&addr, defaultaddr);
|
||||
} else if (tor_addr_port_parse(addrport, &addr, &ptmp) == 0) {
|
||||
if (ptmp == 0) {
|
||||
log_warn(LD_CONFIG, "%sPort line has address but no port", portname);
|
||||
@ -5046,13 +5052,10 @@ parse_client_port_config(smartlist_t *out,
|
||||
}
|
||||
port = ptmp;
|
||||
} else {
|
||||
port = (int) tor_parse_long(addrport, 10, 0, 65535, &ok, NULL);
|
||||
if (!ok) {
|
||||
log_warn(LD_CONFIG, "Couldn't parse address '%s' for %sPort",
|
||||
escaped(addrport), portname);
|
||||
goto err;
|
||||
}
|
||||
tor_addr_from_str(&addr, defaultaddr);
|
||||
}
|
||||
|
||||
/* Now parse the rest of the options, if any. */
|
||||
|
Loading…
Reference in New Issue
Block a user