]> git.ipfire.org Git - pakfire.git/commitdiff
util: Fix potential NULL pointer dereference in pattern matching
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 9 Sep 2023 16:10:20 +0000 (16:10 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 9 Sep 2023 16:10:20 +0000 (16:10 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/util.c

index 0e0d05756fc7d580837eecf44f53aefd9baad5fd..889848c3e7ca3687f2cbfbbbafc16b87d5116dee 100644 (file)
@@ -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...