Skip to content
Snippets Groups Projects
Commit 30b8858d authored by Stephan Bosch's avatar Stephan Bosch
Browse files

Fixed segfault bug triggered by merging side effects in duplicate actions.

parent 9a91c518
No related branches found
No related tags found
No related merge requests found
......@@ -285,10 +285,11 @@ void sieve_result_add_implicit_side_effect
}
static int sieve_result_side_effects_merge
(const struct sieve_runtime_env *renv, const struct sieve_action *action,
struct sieve_side_effects_list *old_seffects,
(const struct sieve_runtime_env *renv, const struct sieve_action *action,
struct sieve_result_action *old_action,
struct sieve_side_effects_list *new_seffects)
{
{
struct sieve_side_effects_list *old_seffects = old_action->seffects;
int ret;
struct sieve_result_side_effect *rsef, *nrsef;
......@@ -353,6 +354,10 @@ static int sieve_result_side_effects_merge
return -1;
if ( ret != 0 ) {
if ( old_action->seffects == NULL )
old_action->seffects = old_seffects =
sieve_side_effects_list_create(old_action->result);
/* Add side effect */
sieve_side_effects_list_add(old_seffects, seffect, new_context);
}
......@@ -421,13 +426,13 @@ static int _sieve_result_add_action
kaction = raction;
if ( (ret=sieve_result_side_effects_merge
(renv, action, kaction->seffects, seffects)) <= 0 )
(renv, action, kaction, seffects)) <= 0 )
return ret;
} else {
/* True duplicate */
return sieve_result_side_effects_merge
(renv, action, raction->seffects, seffects);
(renv, action, raction, seffects);
}
} if ( raction->data.action == action ) {
......@@ -448,7 +453,7 @@ static int _sieve_result_add_action
*/
if ( (ret=sieve_result_side_effects_merge
(renv, action, raction->seffects, seffects)) < 0 )
(renv, action, raction, seffects)) < 0 )
return ret;
if ( kaction == NULL ) {
......@@ -465,13 +470,13 @@ static int _sieve_result_add_action
sieve_result_action_detach(raction);
if ( (ret=sieve_result_side_effects_merge
(renv, action, kaction->seffects, raction->seffects)) < 0 )
(renv, action, kaction, raction->seffects)) < 0 )
return ret;
}
} else {
/* Merge side-effects, but don't add new action */
return sieve_result_side_effects_merge
(renv, action, raction->seffects, seffects);
(renv, action, raction, seffects);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.