Commit 61a66d81 authored by sjaakola's avatar sjaakola Committed by Jan Lindström

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: default avatarJan Lindström <jan.lindstrom@mariadb.com>
parent 49791cbc
......@@ -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)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment