Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Commit 9e6b415

Browse files
author
Ikey Doherty
committed
library: Do not follow symlinks
Signed-off-by: Ikey Doherty <[email protected]>
1 parent 0b918ac commit 9e6b415

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/library/util.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,14 @@ bool find_sources(const char *path, package_match_func match, bool recurse)
4444
return false;
4545
}
4646

47-
if (stat(path, &st) != 0) {
47+
if (lstat(path, &st) != 0) {
4848
goto end;
4949
}
5050

51-
if (S_ISDIR(st.st_mode)) {
51+
if (S_ISLNK(st.st_mode)) {
52+
ret = false;
53+
goto end;
54+
} else if (S_ISDIR(st.st_mode)) {
5255
if (!(dir = opendir(path))) {
5356
goto end;
5457
}

0 commit comments

Comments
 (0)