Edge case with socket becoming NULL

Joe Orton joe at manyfish.co.uk
Sun Aug 2 17:54:25 EDT 2009


On Tue, Jul 28, 2009 at 06:41:14PM +0200, Helge Hess wrote:
> Hi,
>
> code section, ne_request.c, Neon 0.28.5:
> ---snip---
> static int read_message_header(ne_request *req, char *buf, size_t  
> buflen)
> {
>     ssize_t n;
>     ne_socket *sock = req->session->socket;
>
>     n = ne_sock_readline(sock, buf, buflen);
> ---snap---
>
> I've seen the 'sock' ptr become NULL during debugging which then leads  
> to subsequent NULL-ptr deref.

Are you calling ne_begin_request/ne_end_request manually, or via 
ne_request_dispatch?  I can't see how this would happen with 
ne_request_dispatch.

Note that if you're calling ne_begin_request(), you must not call 
ne_end_request() if a ne_read_response_block() call fails - the API is 
perhaps not clear on this point.

Regards, Joe




More information about the neon mailing list