Skip to content

Commit

Permalink
Fix off-by-one in log output line length (#6896)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Gimeno authored and SmallJoker committed Jan 9, 2018
1 parent 63f4ee2 commit f77f19a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,10 @@ void StringBuffer::push_back(char c)
flush(std::string(buffer, buffer_index));
buffer_index = 0;
} else {
int index = buffer_index;
buffer[index++] = c;
if (index >= BUFFER_LENGTH) {
buffer[buffer_index++] = c;
if (buffer_index >= BUFFER_LENGTH) {
flush(std::string(buffer, buffer_index));
buffer_index = 0;
} else {
buffer_index = index;
}
}
}
Expand Down

0 comments on commit f77f19a

Please sign in to comment.