Edge case with socket becoming NULL

Helge Hess me at helgehess.eu
Tue Jul 28 12:41:14 EDT 2009


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.

This is with chunked encoding on Win, end_request() calls the  
read_message_header. My guess is that the the socket times out while  
I'm in a break point and then somehow gets NULLified.

Just wondering whether the code should check for sock == NULL and  
return a NE_ERROR or something?

Thanks,
   Helge





More information about the neon mailing list