From c89b5ab68f501d4f74ef8ff11e6c0a0259d2d926 Mon Sep 17 00:00:00 2001 From: kailixu Date: Wed, 11 Dec 2024 17:27:13 +0800 Subject: [PATCH] enh: use memory safe functions --- source/libs/tfs/src/tfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/tfs/src/tfs.c b/source/libs/tfs/src/tfs.c index 2f175d0688..4ac72e8918 100644 --- a/source/libs/tfs/src/tfs.c +++ b/source/libs/tfs/src/tfs.c @@ -592,10 +592,10 @@ static int32_t tfsFormatDir(char *idir, char *odir) { } int32_t dirLen = strlen(tmp); - if (dirLen >= TSDB_FILENAME_LEN) { + if (dirLen < 0 || dirLen >= TSDB_FILENAME_LEN) { wordfree(&wep); code = TSDB_CODE_OUT_OF_RANGE; - fError("failed to mount %s to FS since %s, real path:%s", idir, tstrerror(code), tmp); + fError("failed to mount %s to FS since %s, real path:%s, len:%d", idir, tstrerror(code), tmp, dirLen); TAOS_RETURN(code); }