Merge remote-tracking branch 'origin/main' into merge/mainto3.0

This commit is contained in:
Shengliang Guan 2024-12-17 23:49:35 +08:00
commit 988f30f255
7 changed files with 7 additions and 7 deletions

View File

@ -26,7 +26,7 @@ typedef struct SCryptOpts {
char* source;
char* result;
int32_t unitLen;
char key[17];
char key[ENCRYPT_KEY_LEN + 1];
} SCryptOpts;
int32_t CBC_Decrypt(SCryptOpts* opts);

View File

@ -211,7 +211,7 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) {
#if defined(TD_ENTERPRISE)
pCfg->tdbEncryptAlgorithm = pCreate->encryptAlgorithm;
if (pCfg->tdbEncryptAlgorithm == DND_CA_SM4) {
tstrncpy(pCfg->tdbEncryptKey, tsEncryptKey, ENCRYPT_KEY_LEN);
tstrncpy(pCfg->tdbEncryptKey, tsEncryptKey, ENCRYPT_KEY_LEN + 1);
}
#else
pCfg->tdbEncryptAlgorithm = 0;

View File

@ -327,7 +327,7 @@ struct SVnodeCfg {
int16_t hashSuffix;
int32_t tsdbPageSize;
int32_t tdbEncryptAlgorithm;
char tdbEncryptKey[ENCRYPT_KEY_LEN];
char tdbEncryptKey[ENCRYPT_KEY_LEN + 1];
int32_t s3ChunkSize;
int32_t s3KeepLocal;
int8_t s3Compact;

View File

@ -104,7 +104,7 @@ int32_t tsdbOpenFile(const char *path, STsdb *pTsdb, int32_t flag, STsdbFD **ppF
}
pFD->path = (char *)&pFD[1];
tstrncpy(pFD->path, path, strlen(path) + 1);
memcpy(pFD->path, path, strlen(path) + 1);
pFD->szPage = szPage;
pFD->flag = flag;
pFD->szPage = szPage;

View File

@ -330,7 +330,7 @@ static int32_t vnodeAsyncInit(SVAsync **async, const char *label) {
return terrno;
}
tstrncpy((char *)((*async) + 1), label, strlen(label) + 1);
memcpy((char *)((*async) + 1), label, strlen(label) + 1);
(*async)->label = (const char *)((*async) + 1);
(void)taosThreadMutexInit(&(*async)->mutex, NULL);

View File

@ -303,7 +303,7 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) {
if (tsEncryptKey[0] == 0) {
return terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY;
} else {
tstrncpy(pCfg->tdbEncryptKey, tsEncryptKey, ENCRYPT_KEY_LEN);
tstrncpy(pCfg->tdbEncryptKey, tsEncryptKey, ENCRYPT_KEY_LEN + 1);
}
}
#endif

View File

@ -417,7 +417,7 @@ SVnode *vnodeOpen(const char *path, int32_t diskPrimary, STfs *pTfs, SMsgCb msgC
}
pVnode->path = (char *)&pVnode[1];
tstrncpy(pVnode->path, path, strlen(path) + 1);
memcpy(pVnode->path, path, strlen(path) + 1);
pVnode->config = info.config;
pVnode->state.committed = info.state.committed;
pVnode->state.commitTerm = info.state.commitTerm;