segfault in clientSocketRecipient

From: Alex Rousskov <rousskov@dont-contact.us>
Date: Thu, 26 Jul 2007 22:26:33 -0600

Hi there,

The clientSocketRecipient function in Squid3 has these lines:

        http->al.reply = HTTPMSGLOCK(rep);
        context->sendStartOfMessage(rep, recievedData);
        
We are getting segfaults because rep can be NULL in the above code.
context->sendStartOfMessage also asserts that rep is not NULL:

        assert(rep);
        MemBuf *mb = rep->pack();

However, much older code (r1.592 of client_side.cc) was more flexible:

    assert(rep || (body_data && body_size));
    if (rep) {
        mb = httpReplyPack(rep);
        ...
        rep = NULL;
    } else {
        memBufDefInit(&mb);
    }

When support for NULL rep case was removed, the commit log said:

> revision 1.593
> date: 2002/09/24 10:46:43; author: robertc; state: Exp; lines: +783 -659
> Client side refactoring - no functionality changes

Does anybody know whether we should resurrect support for the NULL rep
case in clientSocketRecipient? Or, at least, what does it mean that rep
is NULL there?

Thank you,

Alex.
Received on Thu Jul 26 2007 - 22:27:01 MDT

This archive was generated by hypermail pre-2.1.9 : Wed Aug 01 2007 - 12:00:06 MDT