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
This commit is contained in:
Nick Mathewson 2009-01-21 07:24:50 +00:00
parent 3f8ab367c1
commit bf2b71beb8
2 changed files with 6 additions and 4 deletions

View File

@ -4,6 +4,8 @@ Changes in version 0.2.1.12-alpha - 2009-01-??
on 0.2.1.10-alpha; reported by Matt Edman. on 0.2.1.10-alpha; reported by Matt Edman.
- Fix a compile warning on OSX Panther. Fixes bug 913; bugfix against - Fix a compile warning on OSX Panther. Fixes bug 913; bugfix against
0.2.1.11-alpha. 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 Changes in version 0.2.1.11-alpha - 2009-01-20

View File

@ -962,9 +962,9 @@ tor_addr_from_str(tor_addr_t *addr, const char *src)
return result; return result;
} }
/** Parse an address or address-port combination from <b>s</b>, and put the /** Parse an address or address-port combination from <b>s</b>, resolve the
result in <b>addr_out</b> and (optionally) <b>port_out</b>. Return 0 on * address as needed, and put the result in <b>addr_out</b> and (optionally)
success, negative on failure. */ * <b>port_out</b>. Return 0 on success, negative on failure. */
int int
tor_addr_port_parse(const char *s, tor_addr_t *addr_out, uint16_t *port_out) 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, "]"); port = strstr(s, "]");
if (!port) if (!port)
goto err; goto err;
tmp = tor_strndup(s+1, port-s); tmp = tor_strndup(s+1, port-(s+1));
port = port+1; port = port+1;
if (*port == ':') if (*port == ':')
port++; port++;