mirror of
https://github.com/MariaDB/server.git
synced 2025-04-09 16:55:34 +02:00
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>
This commit is contained in:
parent
49791cbc6f
commit
61a66d81b2
1 changed files with 1 additions and 1 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue