diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-05-07 13:56:39 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-05-08 14:24:29 -0400 |
commit | a17dc0875ad0d434d9cf66d36ed23fbd69286bf3 (patch) | |
tree | 9fe2a258f2de58d81d27fa017f6aa40b4653dcb0 /src/or/dirserv.c | |
parent | dbc80ad19b8a27aab557fe7930e18eef8f415133 (diff) | |
download | tor-a17dc0875ad0d434d9cf66d36ed23fbd69286bf3.tar.gz tor-a17dc0875ad0d434d9cf66d36ed23fbd69286bf3.zip |
Avoid unsigned integer underflow on empty input.
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r-- | src/or/dirserv.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c index d9a9b8522d..e47533759b 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -2641,6 +2641,12 @@ measured_bw_line_parse(measured_bw_line_t *out, const char *orig_line) int got_node_id = 0; char *strtok_state; /* lame sauce d'jour */ + if (strlen(line) == 0) { + log_warn(LD_DIRSERV, "Empty line in bandwidth file"); + tor_free(line); + return -1; + } + /* Remove end of line character, so that is not part of the token */ if (line[strlen(line) - 1] == '\n') { line[strlen(line) - 1] = '\0'; |