On 1 Aug 2003, Robert Collins wrote:
> On Fri, 2003-08-01 at 15:31, Songqing Chen wrote:
> > hi, guys,
> >
> > since I need to re-write the url inside with some suffix, so in function
> > parseHttpRequest(...)
> >
> > /* URL may be rewritten later, so make extra room */
> > url_sz = strlen(url) + Config.appendDomainLen + 5;
> > http->uri = xcalloc(url_sz, 1);
> > strcpy(http->uri, url);
> >
> > I add an additional 10.
> >
> > However, sometimes the system can catch Segment Fault, for invaild memory
> > refernce when it tries to free(http->uri).
> >
> > I guess the problem is from this, but not sure. Anyone has any idea on
> > this?
>
> It's probably better to use the external redirector interface rather
> than altering the url internally - it's already well tested and stable.
>
> That said, you should be able to identify the problem using gdb or
> valgrind / memcheck.
Thanks, Rob. For some reasons, I had to change the uri internally.
So I allocate 10 bytes more here, and using the "strcat" to append suffix
(less than 10) to this uri in function
clientInterpretRequestHeaders(clientHttpRequest * http).
Valgrind does lead me here to this "strcat", Invalid write of size 1.
But I don't quite sure the reason.
Do you or anyone else have some idea on this?
Thanks.
Songqing
Received on Fri Aug 01 2003 - 11:21:10 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:20:25 MST