aboutsummaryrefslogtreecommitdiff
path: root/src/feature/dircache
diff options
context:
space:
mode:
authorjuga0 <juga@riseup.net>2018-06-30 13:56:38 +0000
committerjuga0 <juga@riseup.net>2018-07-16 14:43:49 +0000
commit8164534f4669b2a3de075d1f57176540406be991 (patch)
tree8c0171bce45bae3799c237d063ec2139de404fb5 /src/feature/dircache
parent317d930f081936cde6551f1642ddf20983918658 (diff)
downloadtor-8164534f4669b2a3de075d1f57176540406be991.tar.gz
tor-8164534f4669b2a3de075d1f57176540406be991.zip
Ensure that bw_file_headers is not bigger than max
Diffstat (limited to 'src/feature/dircache')
-rw-r--r--src/feature/dircache/dirserv.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/feature/dircache/dirserv.c b/src/feature/dircache/dirserv.c
index c3ccc3c8ff..411a1a0bd3 100644
--- a/src/feature/dircache/dirserv.c
+++ b/src/feature/dircache/dirserv.c
@@ -2679,17 +2679,19 @@ dirserv_read_measured_bandwidths(const char *from_file,
applied_lines++;
/* if the terminator is found, it is the end of header lines, set the
* flag but do not store anything */
- } else if (strcmp(line, BW_FILE_TERMINATOR) == 0)
+ } else if (strcmp(line, BW_FILE_HEADERS_TERMINATOR) == 0) {
line_is_after_headers = 1;
/* if the line was not a correct relay line nor the terminator and
* the end of the header lines has not been detected yet
* and it is key_value and bw_file_headers did not reach the maximum
* number of headers,
* then assume this line is a header and add it to bw_file_headers */
- else if (bw_file_headers &&
+ } else if (bw_file_headers &&
(line_is_after_headers == 0) &&
string_is_key_value(LOG_DEBUG, line) &&
- (smartlist_len(bw_file_headers) < MAX_BW_FILE_HEADERS_LEN)) {
+ !strchr(line, ' ') &&
+ (smartlist_len(bw_file_headers)
+ < MAX_BW_FILE_HEADER_COUNT_IN_VOTE)) {
line[strlen(line)-1] = '\0';
smartlist_add_strdup(bw_file_headers, line);
};