You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by nd...@apache.org on 2003/11/02 01:36:08 UTC

cvs commit: httpd-2.0/modules/metadata mod_setenvif.c

nd          2003/11/01 16:36:08

  Modified:    .        CHANGES
               modules/metadata mod_setenvif.c
  Log:
  fix optimizer to not throw away a regex if it stumbles over it.
  
  PR: 24219
  
  Revision  Changes    Path
  1.1307    +4 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1306
  retrieving revision 1.1307
  diff -u -u -r1.1306 -r1.1307
  --- CHANGES	1 Nov 2003 23:00:24 -0000	1.1306
  +++ CHANGES	2 Nov 2003 00:36:08 -0000	1.1307
  @@ -2,6 +2,10 @@
   
     [Remove entries to the current 2.0 section below, when backported]
   
  +  *) mod_setenvif: Fix the regex optimizer, which under circumstances
  +     treated the supplied regex as literal string. PR 24219.
  +     [Andr� Malo]
  +
     *) mod_autoindex: Don't omit the <tr> start tag if the SuppressIcon
        option is set. PR 21668.  [Jesse Tie-Ten-Quee <hi...@highos.com>]
   
  
  
  
  1.44      +25 -20    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.43
  retrieving revision 1.44
  diff -u -u -r1.43 -r1.44
  --- mod_setenvif.c	24 Oct 2003 16:20:28 -0000	1.43
  +++ mod_setenvif.c	2 Nov 2003 00:36:08 -0000	1.44
  @@ -239,29 +239,34 @@
       int in_escape = 0;
   
       while (*src) {
  -        if (in_escape) {
  +        switch (*src) {
  +        case '^':
  +        case '.':
  +        case '$':
  +        case '|':
  +        case '(':
  +        case ')':
  +        case '[':
  +        case ']':
  +        case '*':
  +        case '+':
  +        case '?':
  +        case '{':
  +        case '}':
  +            if (!in_escape) {
  +                return NULL;
  +            }
               in_escape = 0;
  -        }
  -        else {
  -            switch (*src) {
  -            case '^':
  -            case '.':
  -            case '$':
  -            case '|':
  -            case '(':
  -            case ')':
  -            case '[':
  -            case ']':
  -            case '*':
  -            case '+':
  -            case '?':
  -            case '{':
  -            case '}':
  +            break;
  +        case '\\':
  +            in_escape = 1;
  +            escapes_found = 1;
  +            break;
  +        default:
  +            if (in_escape) {
                   return NULL;
  -            case '\\':
  -                in_escape = 1;
  -                escapes_found = 1;
               }
  +            break;
           }
           src++;
       }