httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n.@apache.org
Subject cvs commit: httpd-2.0/server core.c
Date Sat, 10 Apr 2004 13:57:39 GMT
nd          2004/04/10 06:57:39

  Modified:    .        CHANGES
               modules/metadata mod_setenvif.c mod_usertrack.c
               modules/proxy mod_proxy.c proxy_ftp.c
               server   core.c
  Log:
  Fix a bunch of cases where the return code of the regex compiler
  was not checked properly. This affects: mod_setenvif, mod_usertrack,
  mod_proxy, mod_proxy_ftp and core.
  
  PR: 28218
  
  Revision  Changes    Path
  1.1451    +4 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1450
  retrieving revision 1.1451
  diff -u -u -r1.1450 -r1.1451
  --- CHANGES	10 Apr 2004 13:17:14 -0000	1.1450
  +++ CHANGES	10 Apr 2004 13:57:38 -0000	1.1451
  @@ -2,6 +2,10 @@
   
     [Remove entries to the current 2.0 section below, when backported]
   
  +  *) Fix a bunch of cases where the return code of the regex compiler
  +     was not checked properly. This affects: mod_setenvif, mod_usertrack,
  +     mod_proxy, mod_proxy_ftp and core. PR 28218.  [André Malo]
  +
     *) mod_usertrack: Escape the cookie name before pasting into the
        regexp.  [André Malo]
   
  
  
  
  1.51      +5 -4      httpd-2.0/modules/metadata/mod_setenvif.c
  
  Index: mod_setenvif.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/metadata/mod_setenvif.c,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -u -r1.50 -r1.51
  --- mod_setenvif.c	21 Feb 2004 18:28:30 -0000	1.50
  +++ mod_setenvif.c	10 Apr 2004 13:57:39 -0000	1.51
  @@ -172,11 +172,12 @@
        */
       regex_t *preg = ap_pregcomp(p, "^[-A-Za-z0-9_]*$",
                                   (REG_EXTENDED | REG_NOSUB ));
  -    if (preg) {
  -        if (ap_regexec(preg, name, 0, NULL, 0)) {
  -            return 1;
  -        }
  +    ap_assert(preg != NULL);
  +
  +    if (ap_regexec(preg, name, 0, NULL, 0)) {
  +        return 1;
       }
  +
       return 0;
   }
   
  
  
  
  1.52      +1 -0      httpd-2.0/modules/metadata/mod_usertrack.c
  
  Index: mod_usertrack.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/metadata/mod_usertrack.c,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -u -r1.51 -r1.52
  --- mod_usertrack.c	10 Apr 2004 13:17:15 -0000	1.51
  +++ mod_usertrack.c	10 Apr 2004 13:57:39 -0000	1.52
  @@ -200,6 +200,7 @@
                                         "=([^;,]+)", NULL);
   
       dcfg->regexp = ap_pregcomp(p, dcfg->regexp_string, REG_EXTENDED);
  +    ap_assert(dcfg->regexp != NULL);
   }
   
   static int spot_cookie(request_rec *r)
  
  
  
  1.99      +6 -0      httpd-2.0/modules/proxy/mod_proxy.c
  
  Index: mod_proxy.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/mod_proxy.c,v
  retrieving revision 1.98
  retrieving revision 1.99
  diff -u -u -r1.98 -r1.99
  --- mod_proxy.c	28 Feb 2004 18:06:34 -0000	1.98
  +++ mod_proxy.c	10 Apr 2004 13:57:39 -0000	1.99
  @@ -946,6 +946,9 @@
        */
       if (thiscmd->cmd_data) { /* <ProxyMatch> */
           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);
  @@ -954,6 +957,9 @@
           if (strncasecmp(cmd->path, "proxy:", 6))
               cmd->path += 6;
           r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED);
  +        if (!r) {
  +            return "Regex could not be compiled";
  +        }
       }
   
       /* initialize our config and fetch it */
  
  
  
  1.140     +1 -0      httpd-2.0/modules/proxy/proxy_ftp.c
  
  Index: proxy_ftp.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_ftp.c,v
  retrieving revision 1.139
  retrieving revision 1.140
  diff -u -u -r1.139 -r1.140
  --- proxy_ftp.c	9 Feb 2004 20:29:21 -0000	1.139
  +++ proxy_ftp.c	10 Apr 2004 13:57:39 -0000	1.140
  @@ -427,6 +427,7 @@
   
           /* Compile the output format of "ls -s1" as a fallback for non-unix ftp listings
*/
           re = ap_pregcomp(p, LS_REG_PATTERN, REG_EXTENDED);
  +        ap_assert(re != NULL);
   
           /* get a complete line */
           /* if the buffer overruns - throw data away */
  
  
  
  1.272     +18 -0     httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.271
  retrieving revision 1.272
  diff -u -u -r1.271 -r1.272
  --- core.c	9 Apr 2004 00:56:26 -0000	1.271
  +++ core.c	10 Apr 2004 13:57:39 -0000	1.272
  @@ -1651,9 +1651,15 @@
           if (!cmd->path)
               return "<Directory ~ > block must specify a path";
           r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE);
  +        if (!r) {
  +            return "Regex could not be compiled";
  +        }
       }
       else if (thiscmd->cmd_data) { /* <DirectoryMatch> */
           r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE);
  +        if (!r) {
  +            return "Regex could not be compiled";
  +        }
       }
       else if (!strcmp(cmd->path, "/") == 0)
       {
  @@ -1735,10 +1741,16 @@
   
       if (thiscmd->cmd_data) { /* <LocationMatch> */
           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);
  +        if (!r) {
  +            return "Regex could not be compiled";
  +        }
       }
   
       /* initialize our config and fetch it */
  @@ -1797,10 +1809,16 @@
   
       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);
  +        if (!r) {
  +            return "Regex could not be compiled";
  +        }
       }
       else {
           char *newpath;
  
  
  

Mime
View raw message