diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index 7341d674d35d4ccdc5e122b5a9a9d4205f7f8306..7767dfd55145833e9f511229513e96cc06ce8aeb 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -346,7 +346,7 @@ typedef struct _tsc_obj { char user[TSDB_USER_LEN]; char pass[TSDB_KEY_LEN]; char acctId[TSDB_DB_NAME_LEN]; - char db[TSDB_DB_NAME_LEN]; + char db[TSDB_METER_ID_LEN]; char sversion[TSDB_VERSION_LEN]; char writeAuth : 1; char superAuth : 1; diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 436bfa327a4ed13c1dac699f0851f30a19763e3f..69d1f89079aed7e8aa7c7426ceaccfca01c266c9 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -1795,7 +1795,7 @@ int tscBuildCreateDbMsg(SSqlObj *pSql) { pMsg += sizeof(SMgmtHead); pCreateDbMsg = (SCreateDbMsg *)pMsg; - strcpy(pCreateDbMsg->db, pMeterMetaInfo->name); + strncpy(pCreateDbMsg->db, pMeterMetaInfo->name, tListLen(pCreateDbMsg->db)); pMsg += sizeof(SCreateDbMsg); msgLen = pMsg - pStart; @@ -2017,7 +2017,7 @@ int tscBuildDropDbMsg(SSqlObj *pSql) { pMsg += sizeof(SMgmtHead); pDropDbMsg = (SDropDbMsg *)pMsg; - strcpy(pDropDbMsg->db, pMeterMetaInfo->name); + strncpy(pDropDbMsg->db, pMeterMetaInfo->name, tListLen(pDropDbMsg->db)); pDropDbMsg->ignoreNotExists = htons(pCmd->existsCheck ? 1 : 0); diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index d02251c2121966633e96d5167bb44f452512bb7a..5cc06a751c65b2bfe133c479f73ea6ab3ec65bb7 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -309,7 +309,7 @@ typedef struct { } SCreateMsg; typedef struct { - char db[TSDB_DB_NAME_LEN]; + char db[TSDB_METER_ID_LEN]; short ignoreNotExists; } SDropDbMsg, SUseDbMsg; @@ -594,7 +594,7 @@ typedef struct { // NOTE: sizeof(SVnodeCfg) < TSDB_FILE_HEADER_LEN/4 typedef struct { char acct[TSDB_USER_LEN]; - char db[TSDB_DB_NAME_LEN]; + char db[TSDB_METER_ID_LEN+2]; // 8bytes align uint32_t vgId; int32_t maxSessions; int32_t cacheBlockSize; diff --git a/src/system/detail/inc/mgmt.h b/src/system/detail/inc/mgmt.h index 7cdc36a4465e1b71cce722719083d5476c27dd12..112e75ef1e7372a40f90efb7ec6c445e471c953c 100644 --- a/src/system/detail/inc/mgmt.h +++ b/src/system/detail/inc/mgmt.h @@ -157,7 +157,7 @@ typedef struct _vg_obj { } SVgObj; typedef struct _db_obj { - char name[TSDB_DB_NAME_LEN + 1]; + char name[TSDB_METER_ID_LEN + 1]; int64_t createdTime; SDbCfg cfg; int32_t numOfVgroups;