From 5ca9eca8c403cebc30f9f2f52fdee1f625fb2a8c Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Wed, 1 Dec 2021 05:48:10 -0500 Subject: [PATCH] [core] fix crash when using lighttpd -1 with pipes (fixes #3117) (thx povcfe-bug) In some scenarios with lighttpd -1 on pipes, the event handler associated with the connection (con) will have been cleaned up, and a pending event on the one-off oneshot_fdn will not yet have been handled, leading to a crash. lighttpd typically is used to handle requests on sockets, not pipes. With nc (netcat), the requests might be sent over pipes. The bug occurred with the accommodations made in lighttpd to handle the request over pipes. x-ref: "Trigger crash when using lighttpd -1 with pipes" https://redmine.lighttpd.net/issues/3117 --- src/server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server.c b/src/server.c index c3a4f27d..ae18a35b 100644 --- a/src/server.c +++ b/src/server.c @@ -444,7 +444,7 @@ static handler_t server_oneshot_handle_fdevent(void *context, int revents) { fdevent_fdnode_event_set(con->srv->ev, oneshot_fdn, n); fdnode * const fdn = con->fdn; /* fdn->ctx == con */ - handler_t rc = ((fdevent_handler)NULL != fdn->handler) + handler_t rc = (fdn && (fdevent_handler)NULL != fdn->handler) ? (*fdn->handler)(con, revents) : HANDLER_FINISHED;