libpkgconf: path: supply buffer to realpath #208

Merged
grobian merged 1 commits from master into master 2021-01-08 23:44:41 +00:00
1 changed files with 2 additions and 6 deletions

View File

@ -92,15 +92,11 @@ pkgconf_path_add(const char *text, pkgconf_list_t *dirlist, bool filter)
return; return;
if (S_ISLNK(st.st_mode)) if (S_ISLNK(st.st_mode))
{ {
char *linkdest = realpath(path, NULL); char pathbuf[PATH_MAX];
char *linkdest = realpath(path, pathbuf);
if (linkdest != NULL && stat(linkdest, &st) == -1) if (linkdest != NULL && stat(linkdest, &st) == -1)
{
free(linkdest);
return; return;
}
free(linkdest);
} }
if (path_list_contains_entry(path, dirlist, &st)) if (path_list_contains_entry(path, dirlist, &st))
return; return;