From acb4a0445956590c61c4141e2d9a1ad2d69d8e3b Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 15 Apr 2022 20:17:56 +0800 Subject: [PATCH] complie error --- source/libs/parser/src/parTranslater.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 4fe3d24b8a..c51ec31b81 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -797,12 +797,15 @@ static SNode* createMultiResFunc(SFunctionNode* pSrcFunc, SExprNode* pExpr) { pFunc->funcId = pSrcFunc->funcId; pFunc->funcType = pSrcFunc->funcType; strcpy(pFunc->functionName, pSrcFunc->functionName); + char buf[TSDB_FUNC_NAME_LEN + TSDB_TABLE_NAME_LEN + TSDB_COL_NAME_LEN]; + int32_t len = 0; if (QUERY_NODE_COLUMN == nodeType(pExpr)) { SColumnNode* pCol = (SColumnNode*)pExpr; - snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), "%s(%s.%s)", pSrcFunc->functionName, pCol->tableAlias, pCol->colName); + len = snprintf(buf, sizeof(buf), "%s(%s.%s)", pSrcFunc->functionName, pCol->tableAlias, pCol->colName); } else { - snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), "%s(%s)", pSrcFunc->functionName, pExpr->aliasName); + len = snprintf(buf, sizeof(buf), "%s(%s)", pSrcFunc->functionName, pExpr->aliasName); } + strncpy(pFunc->node.aliasName, buf, TMIN(len, sizeof(pFunc->node.aliasName) - 1)); return (SNode*)pFunc; } -- GitLab