[PATCH 1/2] alpm: test access of symlinks not where they point

morganamilo morganamilo at archlinux.org
Fri Oct 1 22:00:16 UTC 2021


Fixes FS#69720
---
 lib/libalpm/util.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 299d287e..e7b049ce 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -1342,11 +1342,11 @@ int _alpm_access(alpm_handle_t *handle, const char *dir, const char *file, int a
 		CALLOC(check_path, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, -1));
 		snprintf(check_path, len, "%s%s", dir, file);
 
-		ret = access(check_path, amode);
+		ret = faccessat(AT_FDCWD, check_path, amode, AT_SYMLINK_NOFOLLOW);
 		free(check_path);
 	} else {
 		dir = "";
-		ret = access(file, amode);
+		ret = faccessat(AT_FDCWD, file, amode, AT_SYMLINK_NOFOLLOW);
 	}
 
 	if(ret != 0) {
-- 
2.33.0



More information about the pacman-dev mailing list