summaryrefslogtreecommitdiff
path: root/libmu_sieve
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2017-10-10 11:46:44 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2017-10-10 12:30:51 +0300
commit090c7b9a38373ec605535b9bf22ecce2a1433c17 (patch)
tree194e423048cd6f9f785f5da9692b6a955204b515 /libmu_sieve
parent8f23330dc69d1a1e3ccf3687afdcb93cf19b4f76 (diff)
downloadmailutils-090c7b9a38373ec605535b9bf22ecce2a1433c17.tar.gz
mailutils-090c7b9a38373ec605535b9bf22ecce2a1433c17.tar.bz2
Check for NULL return from mu_address_aget_ and mu_address_sget_ family functions
It is possible that these functions return success and place NULL in the result variable. Make sure this possibility is checked throughout the code. * libmailutils/base/usremail.c (mu_set_user_email): Check for NULL return value from mu_address_[as]get. * libmailutils/mailbox/msgenv.c (message_envelope_sender) * libmailutils/tests/addr.c (parse) * libmu_scm/mu_message.c (mu_scm_message_print): * libproto/mailer/prog.c (_expand_rcpt) * libproto/mailer/smtp.c (_rcpt_to_addr) (mu_address_sget_email) * maidag/lmtp.c (check_address): * mail/from.c (hdr_from): * mail/util.c (util_get_sender): * mh/mh_format.c (addr_cmp, builtin_proper) (builtin_addr, builtin_pers, builtin_note) (builtin_mbox, builtin_path, builtin_formataddr) * mh/mh_whom.c (scan_addrs): * libmu_sieve/util.c (mu_sieve_vlist_compare): Skip NULL returns from retr. * libmu_sieve/actions.c (check_redirect_loop): Error checking. * include/mailutils/types.hin (mu_prstr): New function. * libmu_cpp/address.cc: Use mu_prstr to ensure the printable representation of string. * python/libmu_py/address.c: Likewise. * libmu_scm/mu_address.c (_get_address_part): Likewise. * libmailutils/string/wordsplit.c (expvar): Treat NULL value as "".
Diffstat (limited to 'libmu_sieve')
-rw-r--r--libmu_sieve/actions.c18
-rw-r--r--libmu_sieve/util.c2
2 files changed, 13 insertions, 7 deletions
diff --git a/libmu_sieve/actions.c b/libmu_sieve/actions.c
index 39b66fc29..4c025ef8c 100644
--- a/libmu_sieve/actions.c
+++ b/libmu_sieve/actions.c
@@ -373,22 +373,26 @@ check_redirect_loop (mu_message_t msg)
mu_header_get_field_count (hdr, &num);
for (i = 1; !loop && i <= num; i++)
{
- mu_header_get_field_name (hdr, i, buf, sizeof buf, NULL);
+ if (mu_header_get_field_name (hdr, i, buf, sizeof buf, NULL))
+ continue;
if (mu_c_strcasecmp (buf, "X-Loop-Prevention") == 0)
{
size_t j, cnt = 0;
mu_address_t addr;
- mu_header_get_field_value (hdr, i, buf, sizeof buf, NULL);
+ if (mu_header_get_field_value (hdr, i, buf, sizeof buf, NULL))
+ continue;
if (mu_address_create (&addr, buf))
continue;
- mu_address_get_count (addr, &cnt);
- for (j = 1; !loop && j <= cnt; j++)
+ if (mu_address_get_count (addr, &cnt) == 0)
{
- mu_address_get_email (addr, j, buf, sizeof buf, NULL);
- if (mu_c_strcasecmp (buf, email) == 0)
- loop = 1;
+ for (j = 1; !loop && j <= cnt; j++)
+ {
+ if (mu_address_get_email (addr, j, buf, sizeof buf, NULL) == 0
+ && mu_c_strcasecmp (buf, email) == 0)
+ loop = 1;
+ }
}
mu_address_destroy (&addr);
}
diff --git a/libmu_sieve/util.c b/libmu_sieve/util.c
index 3d4763ca7..8d62a60c2 100644
--- a/libmu_sieve/util.c
+++ b/libmu_sieve/util.c
@@ -392,6 +392,8 @@ mu_sieve_vlist_compare (mu_sieve_machine_t mach,
for (j = 0; (rc = retr (item, data, j, &sample)) == 0; j++)
{
+ if (!sample)
+ continue;
rc = mu_list_append (tmp, sample);
if (rc)
{

Return to:

Send suggestions and report system problems to the System administrator.