From 9e6b41532e8d827916d2e47d0a55ea5139d81d37 Mon Sep 17 00:00:00 2001 From: Ikey Doherty Date: Mon, 22 Jun 2015 18:55:14 +0100 Subject: [PATCH] library: Do not follow symlinks Signed-off-by: Ikey Doherty --- src/library/util.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/library/util.c b/src/library/util.c index 492a224..671b177 100644 --- a/src/library/util.c +++ b/src/library/util.c @@ -44,11 +44,14 @@ bool find_sources(const char *path, package_match_func match, bool recurse) return false; } - if (stat(path, &st) != 0) { + if (lstat(path, &st) != 0) { goto end; } - if (S_ISDIR(st.st_mode)) { + if (S_ISLNK(st.st_mode)) { + ret = false; + goto end; + } else if (S_ISDIR(st.st_mode)) { if (!(dir = opendir(path))) { goto end; }