From: Nick Mathewson Date: Wed, 21 Jan 2009 07:24:50 +0000 (+0000) Subject: Fix an error in tor_addr_parse that kept us from having a hidden service or a bridge... X-Git-Tag: tor-0.2.1.12-alpha~48 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bf2b71beb86804acc16f98b8a10ffbb9544ff758;p=thirdparty%2Ftor.git Fix an error in tor_addr_parse that kept us from having a hidden service or a bridge live at an IPv6 address. svn:r18206 --- diff --git a/ChangeLog b/ChangeLog index 5aaeee66b5..453e1865a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ Changes in version 0.2.1.12-alpha - 2009-01-?? on 0.2.1.10-alpha; reported by Matt Edman. - Fix a compile warning on OSX Panther. Fixes bug 913; bugfix against 0.2.1.11-alpha. + - Fix a bug in address parsing that was preventing bridges or hidden + service targets from being at IPv6 addresses. Changes in version 0.2.1.11-alpha - 2009-01-20 diff --git a/src/common/address.c b/src/common/address.c index 0e92b71f91..59412363ab 100644 --- a/src/common/address.c +++ b/src/common/address.c @@ -962,9 +962,9 @@ tor_addr_from_str(tor_addr_t *addr, const char *src) return result; } -/** Parse an address or address-port combination from s, and put the - result in addr_out and (optionally) port_out. Return 0 on - success, negative on failure. */ +/** Parse an address or address-port combination from s, resolve the + * address as needed, and put the result in addr_out and (optionally) + * port_out. Return 0 on success, negative on failure. */ int tor_addr_port_parse(const char *s, tor_addr_t *addr_out, uint16_t *port_out) { @@ -982,7 +982,7 @@ tor_addr_port_parse(const char *s, tor_addr_t *addr_out, uint16_t *port_out) port = strstr(s, "]"); if (!port) goto err; - tmp = tor_strndup(s+1, port-s); + tmp = tor_strndup(s+1, port-(s+1)); port = port+1; if (*port == ':') port++;