From d8998fe4f638cc0b6a31a00a3d91fc4cfe8ef391 Mon Sep 17 00:00:00 2001 From: huangqinjin Date: Mon, 11 May 2020 22:32:02 +0800 Subject: [PATCH] Make message text null-terminated --- src/logging.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/logging.cc b/src/logging.cc index ddcf910..be36117 100644 --- a/src/logging.cc +++ b/src/logging.cc @@ -1509,6 +1509,7 @@ void LogMessage::Flush() { original_final_char = data_->message_text_[data_->num_chars_to_log_]; data_->message_text_[data_->num_chars_to_log_++] = '\n'; } + data_->message_text_[data_->num_chars_to_log_] = '\0'; // Prevent any subtle race conditions by wrapping a mutex lock around // the actual logging action per se.