From: Andreas Gustafsson Date: Tue, 26 Sep 2017 16:23:29 +0000 (+0300) Subject: Do not crash when evhttp_send_reply_start() is called after a timeout. X-Git-Tag: release-2.1.9-beta^2~153 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=826f1134b879cafdb73fed6c4ac1174e3022e410;p=libevent Do not crash when evhttp_send_reply_start() is called after a timeout. This fixes the crash reported in issue #509. The "would be nice" items discussed in #509 can be addressed separately. (cherry picked from commit 99d0a952dada771b91acf63f5208b994e80a2986) --- diff --git a/http.c b/http.c index 8aa2b120..d6dfeea1 100644 --- a/http.c +++ b/http.c @@ -2822,6 +2822,10 @@ evhttp_send_reply_start(struct evhttp_request *req, int code, const char *reason) { evhttp_response_code_(req, code, reason); + + if (req->evcon == NULL) + return; + if (evhttp_find_header(req->output_headers, "Content-Length") == NULL && REQ_VERSION_ATLEAST(req, 1, 1) && evhttp_response_needs_body(req)) {