Skip to content

Commit

Permalink
Use strrchr to ensure we split off the last colon for the service port
Browse files Browse the repository at this point in the history
IPv6 addresses have colons and will produce invalid data for the getaddrinfo lookup.

Signed-off-by: Andrew Thompson <[email protected]>
  • Loading branch information
thompsa authored and sustrik committed Jun 29, 2011
1 parent 543ad30 commit 4f4cc73
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Contributors
============

Alexej Lotz <[email protected]>
Andrew Thompson <[email protected]>
Asko Kauppi <[email protected]>
Barak Amar <[email protected]>
Bernd Prager <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion src/ip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4f4cc73

Please sign in to comment.