fix: invalid read problem

This commit is contained in:
Hongze Cheng 2022-10-20 10:18:28 +08:00
parent 67ed0cf313
commit d9daf76710
1 changed files with 2 additions and 2 deletions

View File

@ -38,7 +38,7 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee
int slen = 0;
*ppTsdb = NULL;
slen = strlen(pVnode->path) + strlen(dir) + 2;
slen = TSDB_FILENAME_LEN;
// create handle
pTsdb = (STsdb *)taosMemoryCalloc(1, sizeof(*pTsdb) + slen);
@ -48,7 +48,7 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee
}
pTsdb->path = (char *)&pTsdb[1];
sprintf(pTsdb->path, "%s%s%s", pVnode->path, TD_DIRSEP, dir);
snprintf(pTsdb->path, TSDB_FILENAME_LEN, "%s%s%s", pVnode->path, TD_DIRSEP, dir);
taosRealPath(pTsdb->path, NULL, slen);
pTsdb->pVnode = pVnode;
taosThreadRwlockInit(&pTsdb->rwLock, NULL);