aboutsummaryrefslogtreecommitdiff
path: root/src/feature/dirparse
diff options
context:
space:
mode:
authorcypherpunks <cypherpunks@torproject.org>2020-02-08 20:20:54 +0000
committercypherpunks <cypherpunks@torproject.org>2020-02-09 01:24:47 +0000
commitb3affc23ef263a978b89e783f55ad3e37c873b9a (patch)
treef7afe87cef9a8e5d81ef58205cdb51cb0053bd15 /src/feature/dirparse
parent5d330997f690845fadbd71f71f26a2ea464cd1ab (diff)
downloadtor-b3affc23ef263a978b89e783f55ad3e37c873b9a.tar.gz
tor-b3affc23ef263a978b89e783f55ad3e37c873b9a.zip
dirparse: reject routerstatus entries with malformed protover
Contrary to its name, protover_contains_long_protocol_names() detects all parse errors, not just long names.
Diffstat (limited to 'src/feature/dirparse')
-rw-r--r--src/feature/dirparse/ns_parse.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/feature/dirparse/ns_parse.c b/src/feature/dirparse/ns_parse.c
index 7cb92ebe59..2354ebf440 100644
--- a/src/feature/dirparse/ns_parse.c
+++ b/src/feature/dirparse/ns_parse.c
@@ -13,6 +13,7 @@
#include "core/or/or.h"
#include "app/config/config.h"
+#include "core/or/protover.h"
#include "core/or/versions.h"
#include "feature/client/entrynodes.h"
#include "feature/dirauth/dirvote.h"
@@ -451,6 +452,10 @@ routerstatus_parse_entry_from_string(memarea_t *area,
}
}
+ // If the protover line is malformed, reject this routerstatus.
+ if (protocols && protover_contains_long_protocol_names(protocols)) {
+ goto err;
+ }
summarize_protover_flags(&rs->pv, protocols, version);
}