summaryrefslogtreecommitdiff
path: root/src/feature/dirparse
diff options
context:
space:
mode:
authorcypherpunks <cypherpunks@torproject.org>2020-02-08 21:11:44 +0000
committercypherpunks <cypherpunks@torproject.org>2020-02-09 01:24:47 +0000
commit8d89aa5eeaef2c009c7fc8250eacc0ed32ebde64 (patch)
tree48cb33c6c98227e121465ad06be3d2df4340b06d /src/feature/dirparse
parentad1b378e87c4f2e000909abed41b80a1ec166113 (diff)
downloadtor-8d89aa5eeaef2c009c7fc8250eacc0ed32ebde64.tar.gz
tor-8d89aa5eeaef2c009c7fc8250eacc0ed32ebde64.zip
dirparse: reject votes with invalid recommended/required protocols
Diffstat (limited to 'src/feature/dirparse')
-rw-r--r--src/feature/dirparse/ns_parse.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/feature/dirparse/ns_parse.c b/src/feature/dirparse/ns_parse.c
index ce548b221e..6172a57bbb 100644
--- a/src/feature/dirparse/ns_parse.c
+++ b/src/feature/dirparse/ns_parse.c
@@ -1168,16 +1168,25 @@ networkstatus_parse_vote_from_string(const char *s, const char **eos_out,
}
}
+ // Reject the vote if any of the protocols lines are malformed.
if ((tok = find_opt_by_keyword(tokens, K_RECOMMENDED_CLIENT_PROTOCOLS))) {
+ if (protover_contains_long_protocol_names(tok->args[0]))
+ goto err;
ns->recommended_client_protocols = tor_strdup(tok->args[0]);
}
if ((tok = find_opt_by_keyword(tokens, K_RECOMMENDED_RELAY_PROTOCOLS))) {
+ if (protover_contains_long_protocol_names(tok->args[0]))
+ goto err;
ns->recommended_relay_protocols = tor_strdup(tok->args[0]);
}
if ((tok = find_opt_by_keyword(tokens, K_REQUIRED_CLIENT_PROTOCOLS))) {
+ if (protover_contains_long_protocol_names(tok->args[0]))
+ goto err;
ns->required_client_protocols = tor_strdup(tok->args[0]);
}
if ((tok = find_opt_by_keyword(tokens, K_REQUIRED_RELAY_PROTOCOLS))) {
+ if (protover_contains_long_protocol_names(tok->args[0]))
+ goto err;
ns->required_relay_protocols = tor_strdup(tok->args[0]);
}