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

[tor-commits] [tor/release-0.2.2] Fix assertion in addressmap_clear_excluded_trackexithosts



commit 2bf0e7479bc9ec26496405ff6a1ef830cacc001b
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Tue Sep 6 20:26:20 2011 -0400

    Fix assertion in addressmap_clear_excluded_trackexithosts
    
    Fixes bug 3923; bugfix on 0.2.2.25-alpha; bugfix from 'laruldan' on trac.
---
 changes/bug3923          |    5 +++++
 src/or/connection_edge.c |   10 ++++------
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/changes/bug3923 b/changes/bug3923
new file mode 100644
index 0000000..9c0e138
--- /dev/null
+++ b/changes/bug3923
@@ -0,0 +1,5 @@
+  o Major bugfies:
+    - Avoid an assertion failure when reloading a configuration with
+      TrackExitHosts changes.  Found and fixed by 'laruldan'. Fixes
+      bug 3923; bugfix on 0.2.2.25-alpha.
+
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index d4d7e1c..8609b02 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -842,12 +842,10 @@ addressmap_clear_excluded_trackexithosts(or_options_t *options)
     if (len < 6)
       continue; /* malformed. */
     dot = target + len - 6; /* dot now points to just before .exit */
-    dot = strrchr(dot, '.'); /* dot now points to the . before .exit or NULL */
-    if (!dot) {
-      nodename = tor_strndup(target, len-5);
-    } else {
-      nodename = tor_strndup(dot+1, strlen(dot+1)-5);
-    }
+    while(dot > target && *dot != '.')
+	dot--;
+    if (*dot == '.') dot++;
+    nodename = tor_strndup(dot, len-5-(dot-target));;
     ri = router_get_by_nickname(nodename, 0);
     tor_free(nodename);
     if (!ri ||



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits