]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: message parser: Made sure that payload stream is always destroyed (hence...
authorStephan Bosch <stephan@rename-it.nl>
Mon, 8 Feb 2016 21:57:13 +0000 (22:57 +0100)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 10 Feb 2016 11:55:26 +0000 (13:55 +0200)
This makes sure that the connection input is always at the correct position
for the next request. Remaining references to the payload stream could
theoretically mess this up.

src/lib-http/http-message-parser.c

index ef70dc49fdd820f22977adbc408d5e2d3cec8810..b0e1724075f8a5c627274754057266e60e0861d4 100644 (file)
@@ -121,7 +121,8 @@ int http_message_parse_finish_payload(struct http_message_parser *parser)
                }
                return ret;
        }
-       i_stream_unref(&parser->payload);
+
+       i_stream_destroy(&parser->payload);
        return 1;
 }
 
@@ -404,6 +405,8 @@ int http_message_parse_body(struct http_message_parser *parser, bool request)
 {
        struct istream *input;
 
+       i_assert(parser->payload == NULL);
+
        parser->error_code = HTTP_MESSAGE_PARSE_ERROR_NONE;
        parser->error = NULL;