diff options
-rw-r--r-- | httpd/patterns.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/httpd/patterns.c b/httpd/patterns.c index 177a5af..e6e1b1f 100644 --- a/httpd/patterns.c +++ b/httpd/patterns.c @@ -425,14 +425,16 @@ match(struct match_state *ms, const char *s, const char *p) /* does not match at least once? */ if (!singlematch(ms, s, p, ep)) { + if (ms->matchdepth-- == 0) { + match_error(ms, "pattern too complex"); + s = NULL; /* failed */ + } + /* accept empty? */ if (*ep == '*' || *ep == '?' || *ep == '-') { + p = ep + 1; /* return match(ms, s, ep + 1); */ - return match(ms, s, ep + 1); - /* - * p = ep + 1; - * goto init; - */ + goto init; } else { /* '+' or no suffix */ s = NULL; /* fail */ |