aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/match.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/match.c b/src/match.c
index 98adf67e..53620bdd 100644
--- a/src/match.c
+++ b/src/match.c
@@ -46,10 +46,14 @@
* and * as wildcards), and zero if it does not match.
*/
static int match_pattern(const char *s, const char *pattern) {
+ if (s == NULL || pattern == NULL) {
+ return 0;
+ }
+
for (;;) {
/* If at end of pattern, accept if also at end of string. */
- if (!*pattern) {
- return !*s;
+ if (*pattern == '\0') {
+ return (*s == '\0');
}
if (*pattern == '*') {