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.
This commit is contained in:
teor 2019-06-06 09:12:14 +10:00
parent 4e262196a8
commit ba83c1e5cf
No known key found for this signature in database
GPG Key ID: 10FEAA0E7075672A
2 changed files with 7 additions and 0 deletions

4
changes/bug30781 Normal file
View File

@ -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.

View 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;
}