aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorteor <teor@torproject.org>2019-06-06 09:12:14 +1000
committerteor <teor@torproject.org>2019-06-06 09:51:24 +1000
commitba83c1e5cf0e4ba0d63cb3728da059a9b241a161 (patch)
treedb66ebd29ca06f4382478cba34af06d63b73d2b4 /src
parent4e262196a88d2a7d3be059d075f53a6f182b2773 (diff)
downloadtor-ba83c1e5cf0e4ba0d63cb3728da059a9b241a161.tar.gz
tor-ba83c1e5cf0e4ba0d63cb3728da059a9b241a161.zip
dirparse: Stop crashing when parsing unknown descriptor purpose annotations
We think this bug can only be triggered by modifying a local file. Fixes bug 30781; bugfix on 0.2.0.8-alpha.
Diffstat (limited to 'src')
-rw-r--r--src/or/routerparse.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 37d2d975fc..f046cc39b4 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -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;
}