From 4f4cc7328054272fa2c972244b2b7e8378ad5429 Mon Sep 17 00:00:00 2001 From: Andrew Thompson Date: Wed, 29 Jun 2011 23:48:19 +0200 Subject: 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 --- AUTHORS | 1 + src/ip.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 616da9b..e9c6a74 100644 --- a/AUTHORS +++ b/AUTHORS @@ -2,6 +2,7 @@ Contributors ============ Alexej Lotz +Andrew Thompson Asko Kauppi Barak Amar Bernd Prager 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; -- cgit v1.2.3