[TD-5534]<fix>:fix the coverity high risk of client
This commit is contained in:
parent
ff9971ffa2
commit
928473f0cb
|
@ -1653,7 +1653,7 @@ static int32_t parseSmlTimeStamp(TAOS_SML_KV **pTS, const char **index) {
|
||||||
|
|
||||||
static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index) {
|
static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index) {
|
||||||
const char *cur = *index;
|
const char *cur = *index;
|
||||||
char key[TSDB_COL_NAME_LEN + 1]; // +1 to avoid 1685 line over write
|
char key[TSDB_COL_NAME_LEN + 1]; // +1 to avoid key[len] over write
|
||||||
uint16_t len = 0;
|
uint16_t len = 0;
|
||||||
|
|
||||||
//key field cannot start with digit
|
//key field cannot start with digit
|
||||||
|
|
|
@ -1628,8 +1628,8 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags
|
||||||
if (pStmt->mtb.subSet && taosHashGetSize(pStmt->mtb.pTableHash) > 0) {
|
if (pStmt->mtb.subSet && taosHashGetSize(pStmt->mtb.pTableHash) > 0) {
|
||||||
STableMetaInfo* pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, 0);
|
STableMetaInfo* pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, 0);
|
||||||
STableMeta* pTableMeta = pTableMetaInfo->pTableMeta;
|
STableMeta* pTableMeta = pTableMetaInfo->pTableMeta;
|
||||||
char sTableName[TSDB_TABLE_FNAME_LEN + 1] = {0};
|
char sTableName[TSDB_TABLE_FNAME_LEN] = {0};
|
||||||
strncpy(sTableName, pTableMeta->sTableName, sizeof(sTableName) - 1);
|
tstrncpy(sTableName, pTableMeta->sTableName, sizeof(sTableName));
|
||||||
|
|
||||||
SStrToken tname = {0};
|
SStrToken tname = {0};
|
||||||
tname.type = TK_STRING;
|
tname.type = TK_STRING;
|
||||||
|
|
|
@ -8366,7 +8366,7 @@ static int32_t doValidateSubquery(SSqlNode* pSqlNode, int32_t index, SSqlObj* pS
|
||||||
return invalidOperationMsg(msgBuf, "subquery alias name too long");
|
return invalidOperationMsg(msgBuf, "subquery alias name too long");
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(pTableMetaInfo1->aliasName, subInfo->aliasName.z, MIN(subInfo->aliasName.n, sizeof(pTableMetaInfo1->aliasName) - 1));
|
tstrncpy(pTableMetaInfo1->aliasName, subInfo->aliasName.z, MIN(subInfo->aliasName.n, sizeof(pTableMetaInfo1->aliasName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
taosArrayPush(pQueryInfo->pUpstream, &pSub);
|
taosArrayPush(pQueryInfo->pUpstream, &pSub);
|
||||||
|
|
|
@ -164,7 +164,7 @@ static void tscUpdateVgroupInfo(SSqlObj *pSql, SRpcEpSet *pEpSet) {
|
||||||
vgroupInfo.inUse = pEpSet->inUse;
|
vgroupInfo.inUse = pEpSet->inUse;
|
||||||
vgroupInfo.numOfEps = pEpSet->numOfEps;
|
vgroupInfo.numOfEps = pEpSet->numOfEps;
|
||||||
for (int32_t i = 0; i < vgroupInfo.numOfEps; i++) {
|
for (int32_t i = 0; i < vgroupInfo.numOfEps; i++) {
|
||||||
strncpy(vgroupInfo.ep[i].fqdn, pEpSet->fqdn[i], TSDB_FQDN_LEN); // buffer not null terminated risk
|
tstrncpy(vgroupInfo.ep[i].fqdn, pEpSet->fqdn[i], TSDB_FQDN_LEN); // buffer not null terminated risk
|
||||||
vgroupInfo.ep[i].port = pEpSet->port[i];
|
vgroupInfo.ep[i].port = pEpSet->port[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1236,10 +1236,6 @@ void handleDownstreamOperator(SSqlObj** pSqlObjList, int32_t numOfUpstream, SQue
|
||||||
}
|
}
|
||||||
|
|
||||||
pSourceOperator = createJoinOperatorInfo(p, px->numOfTables, schema, num);
|
pSourceOperator = createJoinOperatorInfo(p, px->numOfTables, schema, num);
|
||||||
|
|
||||||
for(int32_t i = 0; i < px->numOfTables; ++i) {
|
|
||||||
destroyOperatorInfo(p[i]);
|
|
||||||
}
|
|
||||||
tfree(p);
|
tfree(p);
|
||||||
} else {
|
} else {
|
||||||
size_t num = taosArrayGetSize(px->colList);
|
size_t num = taosArrayGetSize(px->colList);
|
||||||
|
@ -4714,7 +4710,7 @@ static int32_t doAddTableName(char* nextStr, char** str, SArray* pNameArray, SSq
|
||||||
int32_t len = 0;
|
int32_t len = 0;
|
||||||
|
|
||||||
if (nextStr == NULL) {
|
if (nextStr == NULL) {
|
||||||
strncpy(tablename, *str, TSDB_TABLE_FNAME_LEN - 1);
|
tstrncpy(tablename, *str, TSDB_TABLE_FNAME_LEN);
|
||||||
len = (int32_t) strlen(tablename);
|
len = (int32_t) strlen(tablename);
|
||||||
} else {
|
} else {
|
||||||
len = (int32_t)(nextStr - (*str));
|
len = (int32_t)(nextStr - (*str));
|
||||||
|
|
|
@ -578,7 +578,6 @@ void doCompactSDataBlock(SSDataBlock* pBlock, int32_t numOfRows, int8_t* p);
|
||||||
SSDataBlock* createOutputBuf(SExprInfo* pExpr, int32_t numOfOutput, int32_t numOfRows);
|
SSDataBlock* createOutputBuf(SExprInfo* pExpr, int32_t numOfOutput, int32_t numOfRows);
|
||||||
void* destroyOutputBuf(SSDataBlock* pBlock);
|
void* destroyOutputBuf(SSDataBlock* pBlock);
|
||||||
void* doDestroyFilterInfo(SSingleColumnFilterInfo* pFilterInfo, int32_t numOfFilterCols);
|
void* doDestroyFilterInfo(SSingleColumnFilterInfo* pFilterInfo, int32_t numOfFilterCols);
|
||||||
void destroyOperatorInfo(SOperatorInfo* pOperator);
|
|
||||||
|
|
||||||
void setInputDataBlock(SOperatorInfo* pOperator, SQLFunctionCtx* pCtx, SSDataBlock* pBlock, int32_t order);
|
void setInputDataBlock(SOperatorInfo* pOperator, SQLFunctionCtx* pCtx, SSDataBlock* pBlock, int32_t order);
|
||||||
int32_t getNumOfResult(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx* pCtx, int32_t numOfOutput);
|
int32_t getNumOfResult(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx* pCtx, int32_t numOfOutput);
|
||||||
|
|
|
@ -5949,7 +5949,7 @@ static int32_t getNumOfScanTimes(SQueryAttr* pQueryAttr) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroyOperatorInfo(SOperatorInfo* pOperator) {
|
static void destroyOperatorInfo(SOperatorInfo* pOperator) {
|
||||||
if (pOperator == NULL) {
|
if (pOperator == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue