mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-15 10:18:01 +08:00
Problem: problematic atoi function is used (CERT ERR-34C)
Solution: use strtol instead
This commit is contained in:
parent
273137741a
commit
a96a87f343
@ -228,7 +228,7 @@ int zmq::tcp_address_mask_t::resolve (const char *name_, bool ipv6_)
|
|||||||
} else if (mask_str == "0")
|
} else if (mask_str == "0")
|
||||||
_address_mask = 0;
|
_address_mask = 0;
|
||||||
else {
|
else {
|
||||||
const int mask = atoi (mask_str.c_str ());
|
const long mask = strtol (mask_str.c_str (), NULL, 10);
|
||||||
if ((mask < 1)
|
if ((mask < 1)
|
||||||
|| (_network_address.family () == AF_INET6 && mask > full_mask_ipv6)
|
|| (_network_address.family () == AF_INET6 && mask > full_mask_ipv6)
|
||||||
|| (_network_address.family () != AF_INET6
|
|| (_network_address.family () != AF_INET6
|
||||||
@ -236,7 +236,7 @@ int zmq::tcp_address_mask_t::resolve (const char *name_, bool ipv6_)
|
|||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
_address_mask = mask;
|
_address_mask = static_cast<int> (mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user