From 3da37eb2717f5bcc167d158c3fc2433ab2b3d179 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 19 Oct 2016 16:45:38 +0100 Subject: [Fix] Avoid double frees in HEAD requests --- src/libutil/http.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/libutil/http.c b/src/libutil/http.c index dedf8572d..cbafec678 100644 --- a/src/libutil/http.c +++ b/src/libutil/http.c @@ -703,6 +703,10 @@ rspamd_http_on_body (http_parser * parser, const gchar *at, size_t length) } } + if (conn->finished) { + return 0; + } + if (conn->max_size > 0 && msg->body_buf.len + length > conn->max_size) { /* Body length overflow */ @@ -756,6 +760,10 @@ rspamd_http_on_body_decrypted (http_parser * parser, const gchar *at, size_t len priv->header = NULL; } + if (conn->finished) { + return 0; + } + if (priv->msg->body_buf.len == 0) { priv->msg->body_buf.begin = at; @@ -896,6 +904,10 @@ rspamd_http_on_message_complete (http_parser * parser) int ret = 0; enum rspamd_cryptobox_mode mode; + if (conn->finished) { + return 0; + } + priv = conn->priv; if ((conn->opts & RSPAMD_HTTP_BODY_PARTIAL) == 0 && IS_CONN_ENCRYPTED (priv)) { -- cgit v1.2.3