aboutsummaryrefslogtreecommitdiff
path: root/src/or/dirserv.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-05-08 14:26:05 -0400
committerNick Mathewson <nickm@torproject.org>2018-05-08 14:26:05 -0400
commit3df37d7b6be4f7d6ece0cd12812595d5f91ea72f (patch)
tree6770a53f669d987686c67e282170254498683fe5 /src/or/dirserv.c
parent5edc72a45b7479f5fe791054aa19f6b3b478c725 (diff)
parentbed3e8da9cc291546da06d5a5163a3598650d545 (diff)
downloadtor-3df37d7b6be4f7d6ece0cd12812595d5f91ea72f.tar.gz
tor-3df37d7b6be4f7d6ece0cd12812595d5f91ea72f.zip
Merge branch 'bug26004_029_squashed'
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r--src/or/dirserv.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index e058e04f8b..bfcec6e105 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -2459,6 +2459,18 @@ measured_bw_line_parse(measured_bw_line_t *out, const char *orig_line)
int got_bw = 0;
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';
+ }
+
cp = tor_strtok_r(cp, " \t", &strtok_state);
if (!cp) {