fix: invalid memory access of buffer after vsnprintf

This commit is contained in:
wangjiaming0909 2023-05-16 18:12:44 +08:00
parent d57b426dbd
commit 77cfab5093
1 changed files with 1 additions and 0 deletions

View File

@ -556,6 +556,7 @@ void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, cons
len += vsnprintf(buffer + len, LOG_MAX_LINE_DUMP_BUFFER_SIZE - 2 - len, format, argpointer);
va_end(argpointer);
len = len > LOG_MAX_LINE_DUMP_BUFFER_SIZE - 2 ? LOG_MAX_LINE_DUMP_BUFFER_SIZE - 2 : len;
buffer[len++] = '\n';
buffer[len] = 0;