fix coverity 290758, 267837

This commit is contained in:
Bomin Zhang 2020-06-09 17:15:06 +08:00
parent 8fb948ab49
commit fbf249f28c
2 changed files with 3 additions and 3 deletions

View File

@ -2150,7 +2150,7 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
SSqlRes *pRes = &pSql->res;
SCMConnectRsp *pConnect = (SCMConnectRsp *)pRes->pRsp;
strcpy(pObj->acctId, pConnect->acctId); // copy acctId from response
tstrncpy(pObj->acctId, pConnect->acctId, sizeof(pObj->acctId)); // copy acctId from response
int32_t len = sprintf(temp, "%s%s%s", pObj->acctId, TS_PATH_DELIMITER, pObj->db);
assert(len <= sizeof(pObj->db));
@ -2172,7 +2172,7 @@ int tscProcessUseDbRsp(SSqlObj *pSql) {
STscObj * pObj = pSql->pTscObj;
STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(&pSql->cmd, 0, 0);
strcpy(pObj->db, pTableMetaInfo->name);
tstrncpy(pObj->db, pTableMetaInfo->name, sizeof(pObj->db));
return 0;
}

View File

@ -296,7 +296,7 @@ typedef struct {
} SCMConnectMsg;
typedef struct {
char acctId[TSDB_ACCT_LEN + 1];
char acctId[TSDB_ACCT_LEN];
char serverVersion[TSDB_VERSION_LEN];
int8_t writeAuth;
int8_t superAuth;