From ab7e99513c2bc3d53719031cc7ad5c86303b365f Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sat, 9 Sep 2023 16:10:20 +0000 Subject: [PATCH] util: Fix potential NULL pointer dereference in pattern matching Signed-off-by: Michael Tremer --- src/libpakfire/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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... -- 2.39.5