diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index d5915e3e13582f7b825e475004c4ed00b22a6dd0..711760e5499abff27317395669b485c9fd74c9bb 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -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;