[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r18206: {tor} Fix an error in tor_addr_parse that kept us from having a hi (in tor/trunk: . src/common)



Author: nickm
Date: 2009-01-21 02:24:50 -0500 (Wed, 21 Jan 2009)
New Revision: 18206

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/common/address.c
Log:
Fix an error in tor_addr_parse that kept us from having a hidden service or a bridge live at an IPv6 address.

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2009-01-21 04:10:38 UTC (rev 18205)
+++ tor/trunk/ChangeLog	2009-01-21 07:24:50 UTC (rev 18206)
@@ -4,6 +4,8 @@
       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

Modified: tor/trunk/src/common/address.c
===================================================================
--- tor/trunk/src/common/address.c	2009-01-21 04:10:38 UTC (rev 18205)
+++ tor/trunk/src/common/address.c	2009-01-21 07:24:50 UTC (rev 18206)
@@ -962,9 +962,9 @@
   return result;
 }
 
-/** Parse an address or address-port combination from <b>s</b>, and put the
-    result in <b>addr_out</b> and (optionally) <b>port_out</b>.  Return 0 on
-    success, negative on failure. */
+/** Parse an address or address-port combination from <b>s</b>, resolve the
+ * address as needed, and put the result in <b>addr_out</b> and (optionally)
+ * <b>port_out</b>.  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 @@
     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++;