Apply by doing: cd /usr/src patch -p0 < 004_httpd.patch And then rebuild and install httpd and its modules: cd usr.sbin/httpd make -f Makefile.bsd-wrapper obj make -f Makefile.bsd-wrapper cleandir make -f Makefile.bsd-wrapper depend make -f Makefile.bsd-wrapper make -f Makefile.bsd-wrapper install If httpd had been started, you might want to run apachectl stop before running "make install", and apachectl start afterwards. Index: usr.sbin/httpd/src/include/httpd.h =================================================================== RCS file: /cvs/src/usr.sbin/httpd/src/include/httpd.h,v retrieving revision 1.18 retrieving revision 1.18.2.1 diff -u -p -r1.18 -r1.18.2.1 --- usr.sbin/httpd/src/include/httpd.h 21 Aug 2003 13:11:35 -0000 1.18 +++ usr.sbin/httpd/src/include/httpd.h 31 Oct 2003 00:20:31 -0000 1.18.2.1 @@ -291,6 +291,9 @@ extern "C" { /* The size of the server's internal read-write buffers */ #define IOBUFSIZE 8192 +/* The max number of regex captures that can be expanded by ap_pregsub */ +#define AP_MAX_REG_MATCH 10 + /* Number of servers to spawn off by default --- also, if fewer than * this free when the caretaker checks, it will spawn more. */ Index: usr.sbin/httpd/src/modules/standard/mod_alias.c =================================================================== RCS file: /cvs/src/usr.sbin/httpd/src/modules/standard/mod_alias.c,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -u -p -r1.10 -r1.10.2.1 --- usr.sbin/httpd/src/modules/standard/mod_alias.c 21 Aug 2003 13:11:36 -0000 1.10 +++ usr.sbin/httpd/src/modules/standard/mod_alias.c 31 Oct 2003 00:20:31 -0000 1.10.2.1 @@ -304,7 +304,7 @@ static int alias_matches(const char *uri static char *try_alias_list(request_rec *r, array_header *aliases, int doesc, int *status) { alias_entry *entries = (alias_entry *) aliases->elts; - regmatch_t regm[10]; + regmatch_t regm[AP_MAX_REG_MATCH]; char *found = NULL; int i; @@ -313,10 +313,10 @@ static char *try_alias_list(request_rec int l; if (p->regexp) { - if (!ap_regexec(p->regexp, r->uri, p->regexp->re_nsub + 1, regm, 0)) { + if (!ap_regexec(p->regexp, r->uri, AP_MAX_REG_MATCH, regm, 0)) { if (p->real) { found = ap_pregsub(r->pool, p->real, r->uri, - p->regexp->re_nsub + 1, regm); + AP_MAX_REG_MATCH, regm); if (found && doesc) { found = ap_escape_uri(r->pool, found); } Index: usr.sbin/httpd/src/modules/standard/mod_rewrite.c =================================================================== RCS file: /cvs/src/usr.sbin/httpd/src/modules/standard/mod_rewrite.c,v retrieving revision 1.19 retrieving revision 1.19.2.1 diff -u -p -r1.19 -r1.19.2.1 --- usr.sbin/httpd/src/modules/standard/mod_rewrite.c 21 Aug 2003 13:11:37 -0000 1.19 +++ usr.sbin/httpd/src/modules/standard/mod_rewrite.c 31 Oct 2003 00:20:31 -0000 1.19.2.1 @@ -1845,7 +1845,7 @@ static int apply_rewrite_rule(request_re const char *vary; char newuri[MAX_STRING_LEN]; regex_t *regexp; - regmatch_t regmatch[MAX_NMATCH]; + regmatch_t regmatch[AP_MAX_REG_MATCH]; backrefinfo *briRR = NULL; backrefinfo *briRC = NULL; int prefixstrip; @@ -1902,7 +1902,7 @@ static int apply_rewrite_rule(request_re rewritelog(r, 3, "[per-dir %s] applying pattern '%s' to uri '%s'", perdir, p->pattern, uri); } - rc = (ap_regexec(regexp, uri, regexp->re_nsub+1, regmatch, 0) == 0); + rc = (ap_regexec(regexp, uri, AP_MAX_REG_MATCH, regmatch, 0) == 0); if (! (( rc && !(p->flags & RULEFLAG_NOTMATCH)) || (!rc && (p->flags & RULEFLAG_NOTMATCH)) ) ) { return 0; @@ -2190,7 +2190,7 @@ static int apply_rewrite_cond(request_re char input[MAX_STRING_LEN]; struct stat sb; request_rec *rsub; - regmatch_t regmatch[MAX_NMATCH]; + regmatch_t regmatch[AP_MAX_REG_MATCH]; int rc; /* @@ -2294,8 +2294,7 @@ static int apply_rewrite_cond(request_re } else { /* it is really a regexp pattern, so apply it */ - rc = (ap_regexec(p->regexp, input, - p->regexp->re_nsub+1, regmatch,0) == 0); + rc = (ap_regexec(p->regexp, input, AP_MAX_REG_MATCH, regmatch,0) == 0); /* if it isn't a negated pattern and really matched we update the passed-through regex subst info structure */ @@ -2453,7 +2452,7 @@ static void do_expand(request_rec *r, ch bri = briRC; } /* see ap_pregsub() in src/main/util.c */ - if (bri && n <= bri->nsub && + if (bri && n < AP_MAX_REG_MATCH && bri->regmatch[n].rm_eo > bri->regmatch[n].rm_so) { span = bri->regmatch[n].rm_eo - bri->regmatch[n].rm_so; if (span > space) { Index: usr.sbin/httpd/src/modules/standard/mod_rewrite.h =================================================================== RCS file: /cvs/src/usr.sbin/httpd/src/modules/standard/mod_rewrite.h,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -u -p -r1.8 -r1.8.2.1 --- usr.sbin/httpd/src/modules/standard/mod_rewrite.h 21 Aug 2003 13:11:37 -0000 1.8 +++ usr.sbin/httpd/src/modules/standard/mod_rewrite.h 31 Oct 2003 00:20:31 -0000 1.8.2.1 @@ -253,8 +253,6 @@ #define MAX_ENV_FLAGS 15 -#define MAX_NMATCH 10 - /* default maximum number of internal redirects */ #define REWRITE_REDIRECT_LIMIT 10 @@ -368,7 +366,7 @@ typedef struct cache { typedef struct backrefinfo { char *source; int nsub; - regmatch_t regmatch[10]; + regmatch_t regmatch[AP_MAX_REG_MATCH]; } backrefinfo;