]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Avoid segfault if EntryGuardPathBias precedes EntryGuard
authorNick Mathewson <nickm@torproject.org>
Wed, 5 Sep 2012 17:27:54 +0000 (13:27 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 5 Sep 2012 17:27:54 +0000 (13:27 -0400)
Fix for bug 6774; bugfix on 0.2.3.17-beta.

changes/bug6774 [new file with mode: 0644]
src/or/circuitbuild.c

diff --git a/changes/bug6774 b/changes/bug6774
new file mode 100644 (file)
index 0000000..0c137fd
--- /dev/null
@@ -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.
+
index e5576018a61d8ae9c8f76a63ef6ee3d169503112..9d52b5e021723b21dc5ff5b8fffa545af60252a5 100644 (file)
@@ -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));