Commit 4f4cc732 authored by Andrew Thompson's avatar Andrew Thompson Committed by Martin Sustrik

Use strrchr to ensure we split off the last colon for the service port

IPv6 addresses have colons and will produce invalid data for the getaddrinfo lookup.
Signed-off-by: 's avatarAndrew Thompson <andy@fud.org.nz>
parent 543ad30e
......@@ -2,6 +2,7 @@ Contributors
============
Alexej Lotz <alexej.lotz@arcor.de>
Andrew Thompson <andy@fud.org.nz>
Asko Kauppi <askok@dnainternet.net>
Barak Amar <barak.amar@gmail.com>
Bernd Prager <bernd@prager.ws>
......
......@@ -272,7 +272,7 @@ int zmq::resolve_ip_hostname (sockaddr_storage *addr_, socklen_t *addr_len_,
const char *hostname_)
{
// Find the ':' that separates hostname name from service.
const char *delimiter = strchr (hostname_, ':');
const char *delimiter = strrchr (hostname_, ':');
if (!delimiter) {
errno = EINVAL;
return -1;
......
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