]> granicus.if.org Git - libevent/commitdiff
Add a forgotten NULL check to evhttp_parse_headers
authorSebastian Hahn <sebastian@torproject.org>
Mon, 14 Mar 2011 03:13:55 +0000 (04:13 +0100)
committerSebastian Hahn <sebastian@torproject.org>
Sat, 23 Apr 2011 00:04:58 +0000 (02:04 +0200)
Issue detected by the clang static analyzer

http.c

diff --git a/http.c b/http.c
index 0bdf2fa8f1625bdc0730e2ea733657fbac9ee147..df54be7e546207b428e87f5119350aece3c80e89 100644 (file)
--- a/http.c
+++ b/http.c
@@ -1777,7 +1777,8 @@ evhttp_parse_headers(struct evhttp_request *req, struct evbuffer* buffer)
        }
 
        if (status == MORE_DATA_EXPECTED) {
-               if (req->headers_size + evbuffer_get_length(buffer) > req->evcon->max_headers_size)
+               if (req->evcon != NULL &&
+               req->headers_size + evbuffer_get_length(buffer) > req->evcon->max_headers_size)
                        return (DATA_TOO_LONG);
        }