You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Brian Pane <br...@cnet.com> on 2002/05/10 15:58:53 UTC

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

trawick@apache.org wrote:

>  -        if (b->pattern ? apr_strmatch(b->pattern, val, val_len) :
>  +        if ((b->pattern && apr_strmatch(b->pattern, val, val_len)) ||
>               !ap_regexec(b->preg, val, 0, NULL, 0)) {
>

Those two expressions aren't equivalent.  If b->pattern is nonzero
but the apr_strmatch fails, the "||" version will fall through into
the ap_regexec--which will segfault because the regex is going to be
null if b->pattern is non-null.

--Brian




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

Posted by Jeff Trawick <tr...@attglobal.net>.
Brian Pane <br...@cnet.com> writes:

> trawick@apache.org wrote:
> 
> >  -        if (b->pattern ? apr_strmatch(b->pattern, val, val_len) :
> >  +        if ((b->pattern && apr_strmatch(b->pattern, val, val_len)) ||
> >               !ap_regexec(b->preg, val, 0, NULL, 0)) {
> >
> 
> Those two expressions aren't equivalent.  If b->pattern is nonzero
> but the apr_strmatch fails, the "||" version will fall through into
> the ap_regexec--which will segfault because the regex is going to be
> null if b->pattern is non-null.

thanks!

-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...