You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Gregory (Grisha) Trubetskoy" <gr...@ispol.com> on 2002/10/12 21:53:04 UTC

segfault in mod_negotiation.c


--- mod_negotiation.c   Fri Aug  9 15:21:57 2002
+++ mod_negotiation.c.new       Sat Oct 12 15:47:36 2002
@@ -2881,7 +2881,7 @@
     int res;
     int j;

-    if (r->finfo.filetype != APR_NOFILE
+    if (!r->finfo || r->finfo.filetype != APR_NOFILE
         || !(ap_allow_options(r) & OPT_MULTI)) {
         return DECLINED;
     }


Grisha


Re: segfault in mod_negotiation.c

Posted by "Gregory (Grisha) Trubetskoy" <gr...@ispol.com>.
Sorry - nevermind that, obviously I was being extra sloppy, here is
another stab at this.

It segafults if a translate_name doesn't set req->filename. (I don't know
how probable this is, but it did happen to someone using mod_python,
perhpas the way to solve it is to make mod_python guard against this)

The segfault will happen in mod_mime.c, line 807 in find_ct()

    /* If use_path_info is explicitly set to on (value & 1 == 1), append. */
    if (conf->use_path_info & 1) {
        resource_name = apr_pstrcat(r->pool, r->filename, r->path_info, NULL);
    }
    else {
        resource_name = r->filename;
    }

    /* Always drop the path leading up to the file name.
     */
    if ((fn = ap_strrchr_c(resource_name, '/')) == NULL) {

It's not considering the possibility of r->filename being null.

Grisha

On Sat, 12 Oct 2002 rbb@apache.org wrote:

> On 12 Oct 2002, Jeff Trawick wrote:
>
> > "Gregory (Grisha) Trubetskoy" <gr...@ispol.com> writes:
> >
> > > --- mod_negotiation.c   Fri Aug  9 15:21:57 2002
> > > +++ mod_negotiation.c.new       Sat Oct 12 15:47:36 2002
> > > @@ -2881,7 +2881,7 @@
> > >      int res;
> > >      int j;
> > >
> > > -    if (r->finfo.filetype != APR_NOFILE
> > > +    if (!r->finfo || r->finfo.filetype != APR_NOFILE
> > >          || !(ap_allow_options(r) & OPT_MULTI)) {
> > >          return DECLINED;
> > >      }
> >
> > what does it mean to say "!r->finfo" when finfo is a structure, not a pointer?
>
> Better question, how in the world is this seg faulting?????
>
>
> Ryan
>
> _______________________________________________________________________________
> Ryan Bloom                        	rbb@apache.org
> 550 Jean St
> Oakland CA 94610
> -------------------------------------------------------------------------------
>


Re: segfault in mod_negotiation.c

Posted by rb...@apache.org.
On 12 Oct 2002, Jeff Trawick wrote:

> "Gregory (Grisha) Trubetskoy" <gr...@ispol.com> writes:
> 
> > --- mod_negotiation.c   Fri Aug  9 15:21:57 2002
> > +++ mod_negotiation.c.new       Sat Oct 12 15:47:36 2002
> > @@ -2881,7 +2881,7 @@
> >      int res;
> >      int j;
> > 
> > -    if (r->finfo.filetype != APR_NOFILE
> > +    if (!r->finfo || r->finfo.filetype != APR_NOFILE
> >          || !(ap_allow_options(r) & OPT_MULTI)) {
> >          return DECLINED;
> >      }
> 
> what does it mean to say "!r->finfo" when finfo is a structure, not a pointer?

Better question, how in the world is this seg faulting?????


Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
550 Jean St
Oakland CA 94610
-------------------------------------------------------------------------------


Re: segfault in mod_negotiation.c

Posted by Jeff Trawick <tr...@attglobal.net>.
"Gregory (Grisha) Trubetskoy" <gr...@ispol.com> writes:

> --- mod_negotiation.c   Fri Aug  9 15:21:57 2002
> +++ mod_negotiation.c.new       Sat Oct 12 15:47:36 2002
> @@ -2881,7 +2881,7 @@
>      int res;
>      int j;
> 
> -    if (r->finfo.filetype != APR_NOFILE
> +    if (!r->finfo || r->finfo.filetype != APR_NOFILE
>          || !(ap_allow_options(r) & OPT_MULTI)) {
>          return DECLINED;
>      }

what does it mean to say "!r->finfo" when finfo is a structure, not a pointer?

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