diff options
author | Stefan Fritsch <sf@apache.org> | 2011-05-21 22:34:05 +0200 |
---|---|---|
committer | Stefan Fritsch <sf@apache.org> | 2011-05-21 22:34:05 +0200 |
commit | 63366c900bff1d469323edc6ebaaf818b8f346d1 (patch) | |
tree | 767215410170839f1ed1e9eb9dd3b9bfa1d63339 /server/util_pcre.c | |
parent | Updates. (diff) | |
download | apache2-63366c900bff1d469323edc6ebaaf818b8f346d1.tar.xz apache2-63366c900bff1d469323edc6ebaaf818b8f346d1.zip |
Add ap_regexec_len() function that works with non-null-terminated
strings.
PR: 51231
Submitted by: Yehezkel Horowitz <horowity checkpoint com>, Stefan Fritsch
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1125802 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/util_pcre.c')
-rw-r--r-- | server/util_pcre.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/server/util_pcre.c b/server/util_pcre.c index f40d45cbb2..0589e1ada0 100644 --- a/server/util_pcre.c +++ b/server/util_pcre.c @@ -152,11 +152,17 @@ the POSIX structures as was done in earlier releases when PCRE needed only 2 ints. However, if the number of possible capturing brackets is small, use a block of store on the stack, to reduce the use of malloc/free. The threshold is in a macro that can be changed at configure time. */ - AP_DECLARE(int) ap_regexec(const ap_regex_t *preg, const char *string, - apr_size_t nmatch, ap_regmatch_t pmatch[], + apr_size_t nmatch, ap_regmatch_t *pmatch, int eflags) { +return ap_regexec_len(preg, string, strlen(string), nmatch, pmatch, eflags); +} + +AP_DECLARE(int) ap_regexec_len(const ap_regex_t *preg, const char *buff, + apr_size_t len, apr_size_t nmatch, + ap_regmatch_t *pmatch, int eflags) +{ int rc; int options = 0; int *ovector = NULL; @@ -182,7 +188,7 @@ if (nmatch > 0) } } -rc = pcre_exec((const pcre *)preg->re_pcre, NULL, string, (int)strlen(string), +rc = pcre_exec((const pcre *)preg->re_pcre, NULL, buff, (int)len, 0, options, ovector, nmatch * 3); if (rc == 0) rc = nmatch; /* All captured slots were filled in */ |