diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index f01ec1bece361f8c1c03ba42d63411b33992b37b..33ab93d113a565cb7526c5a5eb016ab5dda432e4 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -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; } diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index dca8287394f3a6e401c0527daa238875fb88f693..6a0219d6fc3218218d6d9cd9db0bfd82f13c8d21 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -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;