From 127b1fa6f8c014172f0f8e11de19ace0a6882c24 Mon Sep 17 00:00:00 2001 From: Pedro Gimeno <4267396+pgimeno@users.noreply.github.com> Date: Tue, 9 Jan 2018 19:07:14 +0100 Subject: Fix off-by-one in log output line length (#6896) --- src/log.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/log.cpp b/src/log.cpp index 589cfd909..0dec7dd70 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -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; } } } -- cgit v1.2.3