Geoffrey Young wrote:
> 
> > -----Original Message-----
> > From: Vyacheslav Zamyatin [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, August 14, 2001 4:15 AM
> > To: [EMAIL PROTECTED]
> > Subject: bugfix in Apache::URI
> >
> >
> > Hello all,
> >
> >
> > Here is a small patch that prevents crash in the following example.
> >
> >
> > $referer = 'http://some.host.com';
> > $uri = Apache;:URI->parse($req,$referer);
> > $page = $uri->rpath;
> >
> >
> > If parsed uri don't have path at all, it'll dump core in the
> > last line.
> 
> hmmm...  well, mod_perl shouldn't have to dump core over this, but a path
> component to the URI is required.
> 
> but, it's a problem that has bitten me once or twice as well, so perhaps we
> ought to be helping the users somewhat in this case?
> 
> what about defaulting the path to / if no path is present instead?
> 
> I've actually thought about this in the past and wondered about the best
> solution.  Ideas?
> 
> --Geoff


I didn't expected core dump from this piece of code myself but it does
it everytime in the call to newSVpv with null pointer (tested under
Debian and FreeBSD 4.1).
IMHO the best solution is to patch newSVpv itself thus preventing
similar bugs in other places but I was too lazy to mess with perl
sources :)

> what about defaulting the path to / if no path is present instead?

Inititially I had the same idea but still don't sure that path's
modification is a good solution - in general, someone may want to
distinguish between 'pathed' and 'unpathed' URI's.


> 
> >
> >
> >
> > --- URI.xs      Mon Apr 10 18:07:07 2000
> > +++ /root/src/mod_perl-1.24/src/modules/perl/URI.xs  Tue Aug
> > 14 11:17:57
> > 2001
> > @@ -92,7 +92,8 @@
> >         RETVAL = newSVpv(uri->uri.path, set);
> >      }
> >      else
> > -        RETVAL = newSVpv(uri->uri.path, 0);
> > +        if ( uri->uri.path )
> > +            RETVAL = newSVpv(uri->uri.path, 0);
> >
> >      OUTPUT:
> >      RETVAL
> >
> > --
> > See you in the Net,
> > Slawa
> >

-- 
See you in the Net,
Slawa

Reply via email to