提交 aec022c4 编写于 作者: H hilbert_workstation

fix: #8340 __dest buffer is ensured null-terminated

上级 e1c81f6d
...@@ -80,6 +80,7 @@ void *tsdbDecodeSMFileEx(void *buf, SMFile *pMFile) { ...@@ -80,6 +80,7 @@ void *tsdbDecodeSMFileEx(void *buf, SMFile *pMFile) {
buf = tsdbDecodeMFInfo(buf, &(pMFile->info)); buf = tsdbDecodeMFInfo(buf, &(pMFile->info));
buf = taosDecodeString(buf, &aname); buf = taosDecodeString(buf, &aname);
strncpy(TSDB_FILE_FULL_NAME(pMFile), aname, TSDB_FILENAME_LEN); strncpy(TSDB_FILE_FULL_NAME(pMFile), aname, TSDB_FILENAME_LEN);
*(TSDB_FILE_FULL_NAME(pMFile) + TSDB_FILENAME_LEN - 1) = '\0';
TSDB_FILE_SET_CLOSED(pMFile); TSDB_FILE_SET_CLOSED(pMFile);
tfree(aname); tfree(aname);
...@@ -346,6 +347,7 @@ static void *tsdbDecodeSDFileEx(void *buf, SDFile *pDFile) { ...@@ -346,6 +347,7 @@ static void *tsdbDecodeSDFileEx(void *buf, SDFile *pDFile) {
buf = tsdbDecodeDFInfo(buf, &(pDFile->info), TSDB_LATEST_SFS_VER); buf = tsdbDecodeDFInfo(buf, &(pDFile->info), TSDB_LATEST_SFS_VER);
buf = taosDecodeString(buf, &aname); buf = taosDecodeString(buf, &aname);
strncpy(TSDB_FILE_FULL_NAME(pDFile), aname, TSDB_FILENAME_LEN); strncpy(TSDB_FILE_FULL_NAME(pDFile), aname, TSDB_FILENAME_LEN);
*(TSDB_FILE_FULL_NAME(pDFile) + TSDB_FILENAME_LEN - 1) = '\0';
TSDB_FILE_SET_CLOSED(pDFile); TSDB_FILE_SET_CLOSED(pDFile);
tfree(aname); tfree(aname);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册