[TD-4872]<fix>: fix buffer overflow in -O3 build
This commit is contained in:
parent
2e91314d38
commit
ebd2fdc156
|
@ -480,11 +480,13 @@ static int tfsFormatDir(char *idir, char *odir) {
|
|||
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);
|
||||
wordfree(&wep);
|
||||
return -1;
|
||||
}
|
||||
strcpy(odir, tmp);
|
||||
|
||||
wordfree(&wep);
|
||||
return 0;
|
||||
|
|
|
@ -151,7 +151,7 @@ static bool taosReadDirectoryConfig(SGlobalCfg *cfg, char *input_value) {
|
|||
|
||||
wordfree(&full_path);
|
||||
|
||||
char tmp[1025] = {0};
|
||||
char tmp[PATH_MAX] = {0};
|
||||
if (realpath(option, tmp) != NULL) {
|
||||
strcpy(option, tmp);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue