From: André Malo Date: Wed, 2 Jun 2004 22:49:03 +0000 (+0000) Subject: Fix a bunch of cases where the return code of the regex compiler X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f9f9fcbe4272cf8ce41f08168669455c4d19ec0;p=thirdparty%2Fapache%2Fhttpd.git Fix a bunch of cases where the return code of the regex compiler was not checked properly. This affects mod_usertrack and core. PR: 28218 Reviewed by: Jeff Trawick, Joe Orton git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@103824 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/CHANGES b/src/CHANGES index feea717d8a3..008f7b1520c 100644 --- a/src/CHANGES +++ b/src/CHANGES @@ -1,5 +1,9 @@ Changes with Apache 1.3.32 + *) Fix a bunch of cases where the return code of the regex compiler + was not checked properly. This affects mod_usertrack and + core. PR 28218. [André Malo] + *) No longer breaks mod_dav, frontpage and others. Backs out a patch which prevented discarding the request body for requests that will be keptalive but are not currently keptalive. PR 29237. diff --git a/src/main/http_core.c b/src/main/http_core.c index 38d7982af08..0f9c495d033 100644 --- a/src/main/http_core.c +++ b/src/main/http_core.c @@ -1602,11 +1602,17 @@ static const char *dirsection(cmd_parms *cmd, void *dummy, const char *arg) cmd->override = OR_ALL|ACCESS_CONF; if (thiscmd->cmd_data) { /* */ - r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE); + r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE); + if (!r) { + return "Regex could not be compiled"; + } } else if (!strcmp(cmd->path, "~")) { - cmd->path = ap_getword_conf(cmd->pool, &arg); - r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE); + cmd->path = ap_getword_conf(cmd->pool, &arg); + r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE); + if (!r) { + return "Regex could not be compiled"; + } } #if defined(HAVE_DRIVE_LETTERS) || defined(NETWARE) else if (strcmp(cmd->path, "/") == 0) { @@ -1683,11 +1689,17 @@ static const char *urlsection(cmd_parms *cmd, void *dummy, const char *arg) cmd->override = OR_ALL|ACCESS_CONF; if (thiscmd->cmd_data) { /* */ - r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED); + r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED); + if (!r) { + return "Regex could not be compiled"; + } } else if (!strcmp(cmd->path, "~")) { - cmd->path = ap_getword_conf(cmd->pool, &arg); - r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED); + cmd->path = ap_getword_conf(cmd->pool, &arg); + r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED); + if (!r) { + return "Regex could not be compiled"; + } } old_end_token = cmd->end_token; @@ -1755,10 +1767,16 @@ static const char *filesection(cmd_parms *cmd, core_dir_config *c, if (thiscmd->cmd_data) { /* */ r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE); + if (!r) { + return "Regex could not be compiled"; + } } else if (!strcmp(cmd->path, "~")) { - cmd->path = ap_getword_conf(cmd->pool, &arg); - r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE); + cmd->path = ap_getword_conf(cmd->pool, &arg); + r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE); + if (!r) { + return "Regex could not be compiled"; + } } else { /* Ensure that the pathname is canonical */ diff --git a/src/modules/standard/mod_usertrack.c b/src/modules/standard/mod_usertrack.c index 7ff78bca160..4e1ffa3ff7c 100644 --- a/src/modules/standard/mod_usertrack.c +++ b/src/modules/standard/mod_usertrack.c @@ -264,6 +264,7 @@ static void set_and_comp_regexp(cookie_dir_rec *dcfg, "=([^;]+)|;[ \t]+", cookie_name, "=([^;]+)", NULL); dcfg->regexp = ap_pregcomp(p, dcfg->regexp_string, REG_EXTENDED); + ap_assert(dcfg->regexp != NULL); } static int spot_cookie(request_rec *r)