From e46b5a2d2c88092e32c0a44aadbf39675c1e2b0c Mon Sep 17 00:00:00 2001 From: Stephan Bosch <stephan@rename-it.nl> Date: Sun, 3 Jan 2016 18:20:51 +0100 Subject: [PATCH] lib-sieve: Fixed segfault occurring when default match type of a test is not :is. Would not occur in Pigeonhole itself. --- src/lib-sieve/sieve-match-types.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib-sieve/sieve-match-types.c b/src/lib-sieve/sieve-match-types.c index e2fc3ef9e..f7b5a0410 100644 --- a/src/lib-sieve/sieve-match-types.c +++ b/src/lib-sieve/sieve-match-types.c @@ -481,14 +481,16 @@ bool sieve_match_type_validate /* Verify the default match type if none is specified explicitly */ if ( mt_arg == NULL || mt_arg->argument == NULL || - mt_arg->argument->data == NULL ) { - mtctx = NULL; + mt_arg->argument->data == NULL ) { mcht = sieve_match_type_copy(sieve_command_pool(cmd), mcht_default); + mtctx = t_new(struct sieve_match_type_context, 1); + mtctx->command = cmd; + mtctx->match_type = mcht; } else { mtctx = (struct sieve_match_type_context *) mt_arg->argument->data; mcht = mtctx->match_type; - mtctx->comparator = cmp; } + mtctx->comparator = cmp; /* Check whether this match type requires additional validation. * Additional validation can override the match type recorded in the context -- GitLab