fix: invalid read problem of tsdb path

This commit is contained in:
Cary Xu 2022-11-01 17:07:24 +08:00
parent 872085bef4
commit a96534d945
2 changed files with 9 additions and 2 deletions

View File

@ -245,7 +245,7 @@ void syslog(int unused, const char *format, ...);
#define TD_TIMEZONE_LEN 96
#ifdef WINDOWS
#define TD_PATH_MAX 260
#define TD_PATH_MAX _MAX_PATH
#elif defined(PATH_MAX)
#define TD_PATH_MAX PATH_MAX
#elif defined(_XOPEN_PATH_MAX)

View File

@ -38,7 +38,14 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee
int slen = 0;
*ppTsdb = NULL;
slen = strlen(pVnode->path) + strlen(dir) + 2;
slen = TD_PATH_MAX; //strlen(pVnode->path) + strlen(dir) + 3;
// if (slen > TD_PATH_MAX) {
// terrno = TSDB_CODE_OUT_OF_RANGE;
// tsdbError("vgId:%d, tsdb open failed since %s, path: %s%s%s", TD_VID(pVnode), terrstr(), pVnode->path, TD_DIRSEP,
// dir);
// return -1;
// }
// create handle
pTsdb = (STsdb *)taosMemoryCalloc(1, sizeof(*pTsdb) + slen);