[tor-commits] [tor/master] Avoid segfault if EntryGuardPathBias precedes EntryGuard

nickm at torproject.org nickm at torproject.org
Wed Sep 5 20:26:04 UTC 2012


commit 9d9ca264ec7505cdaf4a0032eac4489be6a52076
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Sep 5 13:27:54 2012 -0400

    Avoid segfault if EntryGuardPathBias precedes EntryGuard
    
    Fix for bug 6774; bugfix on 0.2.3.17-beta.
---
 changes/bug6774       |    4 ++++
 src/or/circuitbuild.c |    6 ++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/changes/bug6774 b/changes/bug6774
new file mode 100644
index 0000000..0c137fd
--- /dev/null
+++ b/changes/bug6774
@@ -0,0 +1,4 @@
+  o Minor bugfixes:
+    - Avoid crashing on a malformed state file where EntryGuardPathBias
+      precedes EntryGuard. Fix for bug 6774; bugfix on 0.2.3.17-beta.
+
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index e557601..9d52b5e 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -4877,6 +4877,12 @@ entry_guards_parse_state(or_state_t *state, int set, char **msg)
       const or_options_t *options = get_options();
       unsigned hop_cnt, success_cnt;
 
+      if (!node) {
+        *msg = tor_strdup("Unable to parse entry nodes: "
+               "EntryGuardPathBias without EntryGuard");
+        break;
+      }
+
       if (tor_sscanf(line->value, "%u %u", &success_cnt, &hop_cnt) != 2) {
         log_warn(LD_GENERAL, "Unable to parse guard path bias info: "
                  "Misformated EntryGuardPathBias %s", escaped(line->value));





More information about the tor-commits mailing list