From 11ace7f5c02a024fed72416598c6f5f146810a91 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 13 Jan 2021 11:35:48 +0800 Subject: [PATCH] [TD-225]fix potential overflow in char array. --- src/client/src/tscSQLParser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index d105c577db..b62d41c821 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -6084,7 +6084,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 + 1 >= totalBufSize) break; offset += sprintf(str + offset, "%s", tmpBuf);