]> git.ipfire.org Git - pakfire.git/commitdiff
pakfire: Fail if pakfire_path() is called without the path being set
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 18 Oct 2024 10:44:10 +0000 (10:44 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 18 Oct 2024 10:44:10 +0000 (10:44 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/pakfire.c

index 17d0a9b0719da2dc347a5a0357b3c25409cd60b5..f1a2694e990f27744f060aef9defc5be6f3c053a 100644 (file)
@@ -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);