mirror of
https://github.com/zeromq/libzmq.git
synced 2025-02-22 07:01:14 +01:00
tcp_address: make port number conversion more robust
This still rejects 00 as port number.
This commit is contained in:
parent
c428f6aece
commit
700e08c3c2
@ -392,10 +392,10 @@ int zmq::tcp_address_t::resolve (const char *name_, bool local_, bool ipv4only_)
|
||||
|
||||
uint16_t port;
|
||||
// Allow 0 specifically, to detect invalid port error in atoi if not
|
||||
if (port_str[0] == '*' || port_str[0] == '0') {
|
||||
if (port_str == "*" || port_str == "0")
|
||||
// Resolve wildcard to 0 to allow autoselection of port
|
||||
port = 0;
|
||||
} else {
|
||||
else {
|
||||
// Parse the port number (0 is not a valid port).
|
||||
port = (uint16_t) atoi (port_str.c_str());
|
||||
if (port == 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user