[Libevent-users] Crash in httpd

Elliot F elliotf-libevent at gratuitous.net
Tue May 22 13:25:33 EDT 2007


Nisan Bloch ­ Clickatell wrote:
> Hi
> 
> If one is using the http server module in libevent1.3b, sending malformed
> headers causes a segfault.
> This is easy to replicate, just telnet to the httpd port and type some junk.
> 
>  Here is a back trace
> #0  0x0040e43e in evhttp_handle_request (req=0x0, arg=0x82696a8) at
> http.c:1242
> #1  0x0040f011 in evhttp_connection_fail (evcon=0x8268cb0) at http.c:333
> #2  0x0040f262 in evhttp_read_header (fd=25, what=2, arg=0x8268cb0) at
> http.c:949
> #3  0x0040af84 in event_base_loop (base=0x8268398, flags=Variable "flags" is
> not available.
> ) at event.c:309
> #4  0x0040b165 in event_loop (flags=136746664) at event.c:358
> #5  0x0040b189 in event_dispatch () at event.c:321
> #6  0x080505b6 in ServerMain (pSrvConfig=0x8220400) at ServerMain.c:125
> #7  0x0804eeba in main (argc=1, argv=0xbffffaa4) at main.c:286
> (gdb) 
> 
> 
> I am not sure whether this should be patched in evhttp_handle_request  or
> evhttp_connection_fail .

That's odd, because I get a 400 response:

$ telnet localhost 1092
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
fasdfsi68&UY^IUYIUYIUY^(*&^*&
HTTP/1.1 400 Bad Request
Content-Type: text/html
Connection: close
Content-Length: 134

<HTML><HEAD>
<TITLE>400 Bad Request</TITLE>
</HEAD><BODY>
<H1>Method Not Implemented</H1>
Invalid method in request<P>
</BODY></HTML>
Connection closed by foreign host.


More information about the Libevent-users mailing list