]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
dirparse: Stop crashing when parsing unknown descriptor purpose annotations
authorteor <teor@torproject.org>
Wed, 5 Jun 2019 23:12:14 +0000 (09:12 +1000)
committerteor <teor@torproject.org>
Wed, 5 Jun 2019 23:51:24 +0000 (09:51 +1000)
We think this bug can only be triggered by modifying a local file.

Fixes bug 30781; bugfix on 0.2.0.8-alpha.

changes/bug30781 [new file with mode: 0644]
src/or/routerparse.c

diff --git a/changes/bug30781 b/changes/bug30781
new file mode 100644 (file)
index 0000000..7c7adf4
--- /dev/null
@@ -0,0 +1,4 @@
+  o Minor bugfixes (directory authorities):
+    - Stop crashing after parsing an unknown descriptor purpose annotation.
+      We think this bug can only be triggered by modifying a local file.
+      Fixes bug 30781; bugfix on 0.2.0.8-alpha.
index 37d2d975fcee42bb18b4d2fecc465d6516baa4b0..f046cc39b473bae08364c023590d378b38b8f7e3 100644 (file)
@@ -1921,6 +1921,9 @@ router_parse_entry_from_string(const char *s, const char *end,
   if ((tok = find_opt_by_keyword(tokens, A_PURPOSE))) {
     tor_assert(tok->n_args);
     router->purpose = router_purpose_from_string(tok->args[0]);
+    if (router->purpose == ROUTER_PURPOSE_UNKNOWN) {
+      goto err;
+    }
   } else {
     router->purpose = ROUTER_PURPOSE_GENERAL;
   }