mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-19 08:46:44 +01:00
Problem: invalid address results in out-of-range string access
Solution: check for zone string length before using it in ip_resolver It turns out std::string::at does not check for string length before dereferencing
This commit is contained in:
parent
3033112645
commit
dccf1723cc
@ -252,6 +252,10 @@ int zmq::ip_resolver_t::resolve (ip_addr_t *ip_addr_, const char *name_)
|
||||
|
||||
if (pos != std::string::npos) {
|
||||
std::string if_str = addr.substr (pos + 1);
|
||||
if (if_str.empty ()) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
addr = addr.substr (0, pos);
|
||||
|
||||
if (isalpha (if_str.at (0))) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user