From 52648e93272eccc0f747955c0a18a70fe2df58e8 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 15 Jan 2021 10:27:22 +0800 Subject: [PATCH] [TD-2247]: fix invalid sql caused client crash. --- src/client/src/tscSQLParser.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index cdf6c3071d..a09e96d678 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -229,7 +229,7 @@ static int32_t handlePassword(SSqlCmd* pCmd, SStrToken* pPwd) { } int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { - if (pInfo == NULL || pSql == NULL || pSql->signature != pSql) { + if (pInfo == NULL || pSql == NULL) { return TSDB_CODE_TSC_APP_ERROR; } @@ -642,7 +642,11 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { } pSql->cmd.parseFinished = 1; - return tscBuildMsg[pCmd->command](pSql, pInfo); + if (tscBuildMsg[pCmd->command] != NULL) { + return tscBuildMsg[pCmd->command](pSql, pInfo); + } else { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), "not support sql expression"); + } } /* -- GitLab