From ae89bf2c4a9e67ce3072f58a63cca0f83af89a8b Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 25 Oct 2024 09:25:00 +0000 Subject: [PATCH] FHS: Ensure the checked path is absolute Signed-off-by: Michael Tremer --- src/libpakfire/fhs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libpakfire/fhs.c b/src/libpakfire/fhs.c index 3bcb78bcd..a60f5676e 100644 --- a/src/libpakfire/fhs.c +++ b/src/libpakfire/fhs.c @@ -25,6 +25,7 @@ #include #include #include +#include #include /* @@ -195,13 +196,16 @@ static const struct pakfire_fhs_check { static const struct pakfire_fhs_check* pakfire_fhs_find_check( struct pakfire_ctx* ctx, struct pakfire_file* file) { const struct pakfire_fhs_check* check = NULL; + char path[PATH_MAX]; int r; // Fetch the file type const mode_t type = pakfire_file_get_type(file); - // Fetch the path - const char* path = pakfire_file_get_path(file); + // Fetch the path and make it absolute + r = pakfire_path_absolute(path, pakfire_file_get_path(file)); + if (r < 0) + goto ERROR; // Walk through all possible checks for (check = pakfire_fhs_check; check->path; check++) { -- 2.39.5