From: Vsevolod Stakhov Date: Wed, 19 Oct 2016 15:45:38 +0000 (+0100) Subject: [Fix] Avoid double frees in HEAD requests X-Git-Tag: 1.4.0~223 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3da37eb2717f5bcc167d158c3fc2433ab2b3d179;p=rspamd.git [Fix] Avoid double frees in HEAD requests --- 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)) {