fix: printSlowLog heap over flow

This commit is contained in:
factosea 2024-01-25 17:02:08 +08:00
parent 834f08a2e0
commit ca6b9f959a
1 changed files with 3 additions and 0 deletions

View File

@ -573,6 +573,9 @@ void taosPrintSlowLog(const char *format, ...) {
len += vsnprintf(buffer + len, LOG_MAX_LINE_DUMP_BUFFER_SIZE - 2 - len, format, argpointer);
va_end(argpointer);
if (len < 0 || len > LOG_MAX_LINE_DUMP_BUFFER_SIZE - 2) {
len = LOG_MAX_LINE_DUMP_BUFFER_SIZE - 2;
}
buffer[len++] = '\n';
buffer[len] = 0;