]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: Do not unref policy payload too early
authorAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 6 Aug 2019 05:44:18 +0000 (08:44 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 10 Sep 2019 07:02:14 +0000 (10:02 +0300)
This can cause the context to be free'd too early leading
to crashes.

src/auth/auth-policy.c

index 9efc81330d95f249f3458fb87f74d48485d99e64..6318db8bf7ad58b918680a86238add1adf73a0c2 100644 (file)
@@ -347,7 +347,6 @@ void auth_policy_parse_response(struct policy_lookup_ctx *context)
                else if (context->parse_state == POLICY_RESULT)
                        context->parse_error = FALSE;
        }
-       i_stream_unref(&context->payload);
 
        if (context->parse_error) {
                context->result = (context->set->policy_reject_on_fail ? -1 : 0);
@@ -376,6 +375,7 @@ void auth_policy_parse_response(struct policy_lookup_ctx *context)
        }
 
        auth_policy_callback(context);
+       i_stream_unref(&context->payload);
 }
 
 static