]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Avoid double frees in HEAD requests
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 19 Oct 2016 15:45:38 +0000 (16:45 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 19 Oct 2016 15:45:38 +0000 (16:45 +0100)
src/libutil/http.c

index dedf8572dd7e2dfde6e7c8f01c622ef4e546e877..cbafec678af7b504d268f10b045bf347c3ba21f8 100644 (file)
@@ -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)) {