To be on the safe side, check the result of realpath().

master
Albert Graef 2018-08-31 12:56:33 +02:00
parent 12767f07c2
commit 18cf14b888
1 changed files with 1 additions and 1 deletions

View File

@ -1548,7 +1548,7 @@ static char *absolute_path(char *name)
char *path = malloc(strlen(pwd)+strlen(name)+2);
static char abspath[PATH_MAX];
sprintf(path, "%s/%s", pwd, name);
realpath(path, abspath);
if (!realpath(path, abspath)) strcpy(abspath, path);
free(path); free(pwd);
return abspath;
}