Merge pull request #17797 from taosdata/fix/td_19618
fix: invalid read problem of tsdb path
This commit is contained in:
commit
d53ab62f00
|
@ -244,6 +244,16 @@ void syslog(int unused, const char *format, ...);
|
|||
#define TD_CHARSET_LEN 64
|
||||
#define TD_TIMEZONE_LEN 96
|
||||
|
||||
#ifdef WINDOWS
|
||||
#define TD_PATH_MAX 260
|
||||
#elif defined(PATH_MAX)
|
||||
#define TD_PATH_MAX PATH_MAX
|
||||
#elif defined(_XOPEN_PATH_MAX)
|
||||
#define TD_PATH_MAX _XOPEN_PATH_MAX
|
||||
#else
|
||||
#define TD_PATH_MAX _POSIX_PATH_MAX
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -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, TD_PATH_MAX, "%s%s%s", pVnode->path, TD_DIRSEP, dir);
|
||||
taosRealPath(pTsdb->path, NULL, slen);
|
||||
pTsdb->pVnode = pVnode;
|
||||
taosThreadRwlockInit(&pTsdb->rwLock, NULL);
|
||||
|
|
Loading…
Reference in New Issue