From 80932329f16e7411eac387806faba4bc56a221a3 Mon Sep 17 00:00:00 2001 From: haojun Liao Date: Thu, 14 Jan 2021 11:03:23 +0800 Subject: [PATCH] Update tscSQLParser.c --- src/client/src/tscSQLParser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index fff3c0cc02..bb103f23c6 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -6101,7 +6101,7 @@ void tscPrintSelectClause(SSqlObj* pSql, int32_t subClauseIndex) { int32_t tmpLen = 0; tmpLen = sprintf(tmpBuf, "%s(uid:%" PRId64 ", %d)", aAggs[pExpr->functionId].aName, pExpr->uid, pExpr->colInfo.colId); - if (tmpLen + offset > totalBufSize) break; + if (tmpLen + offset >= totalBufSize - 1) break; offset += sprintf(str + offset, "%s", tmpBuf); @@ -6110,6 +6110,7 @@ void tscPrintSelectClause(SSqlObj* pSql, int32_t subClauseIndex) { } } + assert(offset < totalBufSize); str[offset] = ']'; tscDebug("%p select clause:%s", pSql, str); } -- GitLab