From: Michael Tremer Date: Fri, 25 Oct 2024 09:25:00 +0000 (+0000) Subject: FHS: Ensure the checked path is absolute X-Git-Tag: 0.9.30~906 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ae89bf2c4a9e67ce3072f58a63cca0f83af89a8b;p=pakfire.git FHS: Ensure the checked path is absolute Signed-off-by: Michael Tremer --- 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++) {