diff --git a/src/lib-sieve/plugins/copy/ext-copy.c b/src/lib-sieve/plugins/copy/ext-copy.c index e15d2ec06f4f43a4d2d67aa0e4dae8779dbde67a..12786a1a83c468b95c75a9157574dd2f525ddd48 100644 --- a/src/lib-sieve/plugins/copy/ext-copy.c +++ b/src/lib-sieve/plugins/copy/ext-copy.c @@ -55,8 +55,10 @@ static bool ext_copy_validator_load(struct sieve_validator *validator) * whether these commands are registered or even whether they will be * registered at all. The validator handles either situation gracefully */ - sieve_validator_register_external_tag(validator, ©_tag, "redirect", -1); - sieve_validator_register_external_tag(validator, ©_tag, "fileinto", -1); + sieve_validator_register_external_tag + (validator, ©_tag, "redirect", SIEVE_OPT_SIDE_EFFECT); + sieve_validator_register_external_tag + (validator, ©_tag, "fileinto", SIEVE_OPT_SIDE_EFFECT); return TRUE; } diff --git a/src/lib-sieve/plugins/imap4flags/cmd-flag.c b/src/lib-sieve/plugins/imap4flags/cmd-flag.c index b0187085c32c42450f9fe78a3d956ef5a0702958..6654b24c2b388f6c587de643fa043d489926e752 100644 --- a/src/lib-sieve/plugins/imap4flags/cmd-flag.c +++ b/src/lib-sieve/plugins/imap4flags/cmd-flag.c @@ -155,6 +155,10 @@ bool cmd_flag_operation_dump sieve_code_mark(denv); operand = sieve_operand_read(denv->sbin, address); + if ( operand == NULL ) { + sieve_code_dumpf(denv, "ERROR: INVALID OPERAND"); + return FALSE; + } if ( sieve_operand_is_variable(operand) ) { return diff --git a/src/lib-sieve/plugins/imap4flags/ext-imap4flags-common.c b/src/lib-sieve/plugins/imap4flags/ext-imap4flags-common.c index ee975b0feeb45520aa0b1bea30533890f5e3b3dd..6ef032a17552ea8cea2c279eee2aafa224f091c9 100644 --- a/src/lib-sieve/plugins/imap4flags/ext-imap4flags-common.c +++ b/src/lib-sieve/plugins/imap4flags/ext-imap4flags-common.c @@ -152,7 +152,7 @@ void ext_imap4flags_attach_flags_tag /* Tag specified by user */ sieve_validator_register_external_tag - (valdtr, &tag_flags, command, -1); + (valdtr, &tag_flags, command, SIEVE_OPT_SIDE_EFFECT); /* Implicit tag if none is specified */ sieve_validator_register_persistent_tag diff --git a/src/lib-sieve/plugins/imap4flags/tag-flags.c b/src/lib-sieve/plugins/imap4flags/tag-flags.c index 5755f05f6121a31bca8afe1aae6c602103aae481..6a85ab94b1dda37d78409a1cf66b8f02afe2d787 100644 --- a/src/lib-sieve/plugins/imap4flags/tag-flags.c +++ b/src/lib-sieve/plugins/imap4flags/tag-flags.c @@ -196,6 +196,11 @@ static bool seff_flags_dump_context const struct sieve_operand *operand; operand = sieve_operand_read(denv->sbin, address); + if ( operand == NULL ) { + sieve_code_dumpf(denv, "ERROR: INVALID OPERAND"); + return FALSE; + } + if ( sieve_operand_is_omitted(operand) ) { sieve_code_dumpf(denv, "flags: INTERNAL"); diff --git a/src/lib-sieve/plugins/mailbox/ext-mailbox.c b/src/lib-sieve/plugins/mailbox/ext-mailbox.c index 3419e3c90627b14889a3fc16cfaa9a4c219ffdac..bb777923c8ffada6180096580e4a1c22603d3dd9 100644 --- a/src/lib-sieve/plugins/mailbox/ext-mailbox.c +++ b/src/lib-sieve/plugins/mailbox/ext-mailbox.c @@ -51,7 +51,7 @@ static bool ext_mailbox_validator_load(struct sieve_validator *valdtr) * validator handles either situation gracefully */ sieve_validator_register_external_tag - (valdtr, &mailbox_create_tag, "fileinto", -1); + (valdtr, &mailbox_create_tag, "fileinto", SIEVE_OPT_SIDE_EFFECT); /* Register new test */ sieve_validator_register_command(valdtr, &mailboxexists_test); diff --git a/src/lib-sieve/sieve-actions.h b/src/lib-sieve/sieve-actions.h index 901e5050ff838643c8a041509297fcabba3093a4..8a735274b9737a5fa0f06d52e9e5ad3baae39b8c 100644 --- a/src/lib-sieve/sieve-actions.h +++ b/src/lib-sieve/sieve-actions.h @@ -153,7 +153,7 @@ struct sieve_side_effect { #define SIEVE_EXT_DEFINE_SIDE_EFFECT(SEF) SIEVE_EXT_DEFINE_OBJECT(SEF) #define SIEVE_EXT_DEFINE_SIDE_EFFECTS(SEFS) SIEVE_EXT_DEFINE_OBJECTS(SEFS) -#define SIEVE_OPT_SIDE_EFFECT -1 +#define SIEVE_OPT_SIDE_EFFECT (-1) extern const struct sieve_operand_class sieve_side_effect_operand_class; diff --git a/src/lib-sieve/sieve-code.h b/src/lib-sieve/sieve-code.h index db38e7d90b75169138d359b49197701c3cf0fd36..984a1bc6a72ec604a7fbe5f382b43c70e2c3d8f9 100644 --- a/src/lib-sieve/sieve-code.h +++ b/src/lib-sieve/sieve-code.h @@ -79,7 +79,7 @@ bool sieve_operand_optional_read /* Operand codes */ enum sieve_core_operand { - SIEVE_OPERAND_OPTIONAL, + SIEVE_OPERAND_OPTIONAL = 0x00, SIEVE_OPERAND_NUMBER, SIEVE_OPERAND_STRING, SIEVE_OPERAND_STRING_LIST,