aboutsummaryrefslogtreecommitdiff
path: root/src/feature/dircache/dirserv.c
diff options
context:
space:
mode:
authorjuga0 <juga@riseup.net>2018-05-31 09:03:39 +0000
committerjuga0 <juga@riseup.net>2018-07-16 14:43:49 +0000
commitf0a4a5f726cf1939461cbf9a4b73060770bbc3e7 (patch)
treee79d7991bf9770652db23f0797fe59a41e1a5abf /src/feature/dircache/dirserv.c
parent086060e138d0fe5904a8b09d48bdcf9d8922af39 (diff)
downloadtor-f0a4a5f726cf1939461cbf9a4b73060770bbc3e7.tar.gz
tor-f0a4a5f726cf1939461cbf9a4b73060770bbc3e7.zip
Check that the header is key_value
to avoid interpreting as headers extra lines that are not key_values
Diffstat (limited to 'src/feature/dircache/dirserv.c')
-rw-r--r--src/feature/dircache/dirserv.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/feature/dircache/dirserv.c b/src/feature/dircache/dirserv.c
index ea7b29c464..e7b5239e0b 100644
--- a/src/feature/dircache/dirserv.c
+++ b/src/feature/dircache/dirserv.c
@@ -2674,7 +2674,10 @@ dirserv_read_measured_bandwidths(const char *from_file,
if (measured_bw_line_apply(&parsed_line, routerstatuses) > 0)
applied_lines++;
} else {
- if (strcmp(line, "====\n") != 0) {
+ /* If line does not contain the header separator and it is key_value,
+ * it is probably a KeyValue header.*/
+ if (strcmp(line, "====\n") != 0 &&
+ string_is_key_value(LOG_DEBUG, line)) {
line[strlen(line)-1] = '\0';
smartlist_add_strdup(bwlist_headers, line);
};