mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Avoid unsigned integer underflow on empty input.
This commit is contained in:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user