diff options
author | sjaakola <seppo.jaakola@iki.fi> | 2021-12-20 12:07:20 +0200 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2021-12-21 12:47:19 +0200 |
commit | 61a66d81b2bfc3a7c8c9a07d8c82d921eacba284 (patch) | |
tree | 195db15ccb5438ab336db3aa93a2f7a89869eaa6 | |
parent | 49791cbc6f76c4f4c1bb436dbe26cec6177ee279 (diff) | |
download | mariadb-git-61a66d81b2bfc3a7c8c9a07d8c82d921eacba284.tar.gz |
MDEV-27297 wsrep error log messages drop last character
vsnprintf takes the space need for trailing '\0' in consideration, and copies only n-1 characters to destination buffer.
With the old code, only sizeof(buf)-2 characters were copied, this caused that last character of message could be lost.
Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
-rw-r--r-- | sql/wsrep_mysqld.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 1e4eff831c2..f2b04393340 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -288,7 +288,7 @@ void WSREP_LOG(void (*fun)(const char* fmt, ...), const char* fmt, ...) char msg[128] = {'\0'}; va_list arglist; va_start(arglist, fmt); - int n= vsnprintf(msg, sizeof(msg) - 1, fmt, arglist); + int n= vsnprintf(msg, sizeof(msg), fmt, arglist); va_end(arglist); if (n < 0) { |