diff options
author | Sébastien Marie <semarie@users.noreply.github.com> | 2015-06-23 10:50:15 +0200 |
---|---|---|
committer | Sébastien Marie <semarie@users.noreply.github.com> | 2015-06-23 10:50:15 +0200 |
commit | cb9aff69125a32fd4327cce7079eb18273356d92 (patch) | |
tree | 7457d2c9266c0effc7ea2a7da3798c3466e35572 | |
parent | 2e5a82bd8af77e44afb01b1c366641511fdd8099 (diff) | |
download | httpd-cb9aff69125a32fd4327cce7079eb18273356d92.tar.gz httpd-cb9aff69125a32fd4327cce7079eb18273356d92.zip |
add '+' to limited matchdepth
- revert "normal" call to optimized-tail-call-recursion for '*', '?' and
'-'
- add a "pattern too complex" test to !singlematch() branch, so that it
is limited on call numbers.
-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 */ |