]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Fix a bunch of cases where the return code of the regex compiler
authorAndré Malo <nd@apache.org>
Wed, 2 Jun 2004 22:49:03 +0000 (22:49 +0000)
committerAndré Malo <nd@apache.org>
Wed, 2 Jun 2004 22:49:03 +0000 (22:49 +0000)
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

src/CHANGES
src/main/http_core.c
src/modules/standard/mod_usertrack.c

index feea717d8a39c415d13e990a7d27abd72fdfe686..008f7b1520cd965e070280544ad74a853088ef5d 100644 (file)
@@ -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.
index 38d7982af0888922929518ea6495e896776ed12f..0f9c495d03349382e941a9d1da88cbf14298e92b 100644 (file)
@@ -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) { /* <DirectoryMatch> */
-       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) { /* <LocationMatch> */
-       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) { /* <FilesMatch> */
         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 */
index 7ff78bca160e95ff6337d12fa6b558fe9a032153..4e1ffa3ff7c45be70b11c7ffe2b5087d4c82403d 100644 (file)
@@ -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)