From: Michael Tremer Date: Sat, 9 Sep 2023 16:10:20 +0000 (+0000) Subject: util: Fix potential NULL pointer dereference in pattern matching X-Git-Tag: 0.9.29~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ab7e99513c2bc3d53719031cc7ad5c86303b365f;p=pakfire.git util: Fix potential NULL pointer dereference in pattern matching Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/util.c b/src/libpakfire/util.c index 0e0d05756..889848c3e 100644 --- a/src/libpakfire/util.c +++ b/src/libpakfire/util.c @@ -174,7 +174,7 @@ static int __pakfire_path_match_star(const char* p, const char* s) { } // The pattern has not entirely been consumed - if (*p) + if (p && *p) return 0; // If we reached the end of the string, * has consumed everything @@ -187,7 +187,7 @@ static int __pakfire_path_match_star(const char* p, const char* s) { */ int pakfire_path_match(const char* p, const char* s) { // Empty pattern matches nothing - if (!*p) + if (!p || !*p) return 0; // Consume the pattern and string...