From: Felix Nawothnig Date: Sun, 30 May 2010 01:17:48 +0000 (+0200) Subject: Fix possible nullptr dereference in evhttp_send_reply_end() X-Git-Tag: release-2.0.6-rc~46 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=29b2e233a7a4eb0f1842368770d545a685743d80;p=libevent Fix possible nullptr dereference in evhttp_send_reply_end() (The existing implementation had sanity-checking code for the case where its argument was NULL, but it erroneously dereferenced it before actually doing the sanity-check. --nickm) --- diff --git a/http.c b/http.c index 3f39e0bf..19d4f91d 100644 --- a/http.c +++ b/http.c @@ -2145,13 +2145,15 @@ void evhttp_send_reply_end(struct evhttp_request *req) { struct evhttp_connection *evcon = req->evcon; - struct evbuffer *output = bufferevent_get_output(evcon->bufev); + struct evbuffer *output; if (evcon == NULL) { evhttp_request_free(req); return; } + output = bufferevent_get_output(evcon->bufev); + /* we expect no more calls form the user on this request */ req->userdone = 1;