commit c8c2e2b8fcc4d99adce600da8210a5e9ae653daf
parent e5deb2bbc73d8830ae6c479a4532e72112f5484a
Author: teor <teor@torproject.org>
Date: Thu, 6 Jun 2019 09:55:44 +1000
Merge branch 'bug30781_034' into bug30781_035
Moved fix from src/or/routerparse.c to src/feature/dirparse/routerparse.c.
Diffstat:
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/changes/bug30781 b/changes/bug30781
@@ -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.
diff --git a/src/feature/dirparse/routerparse.c b/src/feature/dirparse/routerparse.c
@@ -556,6 +556,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;
}