summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Thompson <andy@fud.org.nz>2011-06-29 23:48:19 +0200
committerMartin Sustrik <sustrik@250bpm.com>2011-06-29 23:48:19 +0200
commit4f4cc7328054272fa2c972244b2b7e8378ad5429 (patch)
tree4dd51c2dc8201f414dcf98f6897d95698579bdc7
parent543ad30e7d15a8864df26d6d32e57246ede35ae3 (diff)
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: Andrew Thompson <andy@fud.org.nz>
-rw-r--r--AUTHORS1
-rw-r--r--src/ip.cpp2
2 files changed, 2 insertions, 1 deletions
diff --git a/AUTHORS b/AUTHORS
index 616da9b..e9c6a74 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -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>
diff --git a/src/ip.cpp b/src/ip.cpp
index c24d92f..a4f9562 100644
--- a/src/ip.cpp
+++ b/src/ip.cpp
@@ -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;