[tor-commits] [tor/master] Check that the header is key_value

nickm at torproject.org nickm at torproject.org
Mon Jul 30 12:45:07 UTC 2018


commit f0a4a5f726cf1939461cbf9a4b73060770bbc3e7
Author: juga0 <juga at riseup.net>
Date:   Thu May 31 09:03:39 2018 +0000

    Check that the header is key_value
    
    to avoid interpreting as headers extra lines that are not key_values
---
 src/feature/dircache/dirserv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/feature/dircache/dirserv.c b/src/feature/dircache/dirserv.c
index ea7b29c46..e7b5239e0 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);
         };





More information about the tor-commits mailing list