On Sun, Mar 30, 2014 at 2:20 PM,  <rj...@apache.org> wrote:
> Author: rjung
> Date: Sun Mar 30 18:20:09 2014
> New Revision: 1583175
>
> URL: http://svn.apache.org/r1583175
> Log:
> Fix segfault in mod_alias introduced in r1132494.
>
> AliasMatch does not append unmatched parts of the
> original URI to the  new URI. So no need to subtract
> anything from the new URI length.
>
> The existing code crashed when using
> "AliasMatch / /some/thing" and sending a request
> with a long URI.
>
> Modified:
>     httpd/httpd/trunk/modules/mappers/mod_alias.c
>
> Modified: httpd/httpd/trunk/modules/mappers/mod_alias.c
> URL: 
> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_alias.c?rev=1583175&r1=1583174&r2=1583175&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/mappers/mod_alias.c (original)
> +++ httpd/httpd/trunk/modules/mappers/mod_alias.c Sun Mar 30 18:20:09 2014
> @@ -371,15 +371,11 @@ static char *try_alias_list(request_rec
>                              }
>                         }
>                         else {
> -                           int pathlen = strlen(found) -
> -                                         (strlen(r->uri + regm[0].rm_eo));
> -                           AP_DEBUG_ASSERT(pathlen >= 0);
> -                           AP_DEBUG_ASSERT(pathlen <= strlen(found));
>                             ap_set_context_info(r,
>                                                 apr_pstrmemdup(r->pool, 
> r->uri,
>                                                                regm[0].rm_eo),
>                                                 apr_pstrmemdup(r->pool, found,
> -                                                              pathlen));
> +                                                              
> strlen(found)));
>                         }
>                      }
>                      else {
>
>

AFAICT {
In as much that it was ever useful, this breaks people relying on the
"context info" for aliasmatches structured the way this code was
originally biased to expecting:

  AliasMatch ^(/foo/bar/)(.*) /var/www/baz/$1

IMO might be best to just never set context info here, or not set it
when the first capture is not starting at offset 0.
}


-- 
Eric Covener
cove...@gmail.com

Reply via email to