Commit 700e08c3 authored by Martin Hurton's avatar Martin Hurton

tcp_address: make port number conversion more robust

This still rejects 00 as port number.
parent c428f6ae
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment