From d0259e65d5cd06d4d2917174db105d0d7bc7929e Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 18 Oct 2024 10:44:10 +0000 Subject: [PATCH] pakfire: Fail if pakfire_path() is called without the path being set Signed-off-by: Michael Tremer --- src/libpakfire/pakfire.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libpakfire/pakfire.c b/src/libpakfire/pakfire.c index 17d0a9b07..f1a2694e9 100644 --- a/src/libpakfire/pakfire.c +++ b/src/libpakfire/pakfire.c @@ -999,6 +999,12 @@ int __pakfire_path(struct pakfire* pakfire, char* path, const size_t length, va_list args; int r; + // Check if path is set + if (!*pakfire->path) { + CTX_ERROR(pakfire->ctx, "pakfire_path() called without path being set\n"); + return -ENOTSUP; + } + // Format input into buffer va_start(args, format); r = __pakfire_string_vformat(buffer, sizeof(buffer), format, args); -- 2.39.5