提交 ebd2fdc1 编写于 作者: H Huo Linhe

[TD-4872]<fix>: fix buffer overflow in -O3 build

上级 2e91314d
...@@ -480,11 +480,13 @@ static int tfsFormatDir(char *idir, char *odir) { ...@@ -480,11 +480,13 @@ static int tfsFormatDir(char *idir, char *odir) {
return -1; return -1;
} }
if (realpath(wep.we_wordv[0], odir) == NULL) { char tmp[PATH_MAX] = {0};
if (realpath(wep.we_wordv[0], tmp) == NULL) {
terrno = TAOS_SYSTEM_ERROR(errno); terrno = TAOS_SYSTEM_ERROR(errno);
wordfree(&wep); wordfree(&wep);
return -1; return -1;
} }
strcpy(odir, tmp);
wordfree(&wep); wordfree(&wep);
return 0; return 0;
......
...@@ -151,7 +151,7 @@ static bool taosReadDirectoryConfig(SGlobalCfg *cfg, char *input_value) { ...@@ -151,7 +151,7 @@ static bool taosReadDirectoryConfig(SGlobalCfg *cfg, char *input_value) {
wordfree(&full_path); wordfree(&full_path);
char tmp[1025] = {0}; char tmp[PATH_MAX] = {0};
if (realpath(option, tmp) != NULL) { if (realpath(option, tmp) != NULL) {
strcpy(option, tmp); strcpy(option, tmp);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册