diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-10-10 12:54:52 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-10-10 12:54:52 +0300 |
commit | 5589f8787925cb3b05078ecfd55c54b36aed637d (patch) | |
tree | 0e626e7d233e5a03fe7aadf6c67a276dcb811de1 /mu/libexec/imap.c | |
parent | 090c7b9a38373ec605535b9bf22ecce2a1433c17 (diff) | |
download | mailutils-5589f8787925cb3b05078ecfd55c54b36aed637d.tar.gz mailutils-5589f8787925cb3b05078ecfd55c54b36aed637d.tar.bz2 |
Use mu_prtstr to safely print string values
Diffstat (limited to 'mu/libexec/imap.c')
-rw-r--r-- | mu/libexec/imap.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/mu/libexec/imap.c b/mu/libexec/imap.c index 37d494a7a..b44757677 100644 --- a/mu/libexec/imap.c +++ b/mu/libexec/imap.c @@ -200,13 +200,12 @@ format_date (mu_stream_t str, char *name, off /= 60; mu_stream_printf (str, "%02d%02d", off / 60, off % 60); } mu_stream_printf (str, "\n"); } -#define S(str) ((str) ? (str) : "") static void print_param (mu_stream_t ostr, const char *prefix, mu_assoc_t assoc, int indent) { mu_iterator_t itr; @@ -266,48 +265,53 @@ print_imapenvelope (mu_stream_t ostr, struct mu_imapenvelope *env, int level) int indent = (level << 2); mu_stream_printf (ostr, "%*sEnvelope:\n", indent, ""); indent += 4; mu_stream_printf (ostr, "%*sTime: ", indent, ""); mu_c_streamftime (mu_strout, "%c%n", &env->date, &env->tz); - mu_stream_printf (ostr, "%*sSubject: %s\n", indent, "", S(env->subject)); + mu_stream_printf (ostr, "%*sSubject: %s\n", indent, "", + mu_prstr (env->subject)); print_address (ostr, "From", env->from, indent); print_address (ostr, "Sender", env->sender, indent); print_address (ostr, "Reply-to", env->reply_to, indent); print_address (ostr, "To", env->to, indent); print_address (ostr, "Cc", env->cc, indent); print_address (ostr, "Bcc", env->bcc, indent); mu_stream_printf (ostr, "%*sIn-Reply-To: %s\n", indent, "", - S(env->in_reply_to)); + mu_prstr (env->in_reply_to)); mu_stream_printf (ostr, "%*sMessage-ID: %s\n", indent, "", - S(env->message_id)); + mu_prstr (env->message_id)); } static void print_bs (mu_stream_t ostr, struct mu_bodystructure *bs, int level) { int indent = level << 2; - mu_stream_printf (ostr, "%*sbody_type=%s\n", indent, "", S(bs->body_type)); + mu_stream_printf (ostr, "%*sbody_type=%s\n", indent, "", + mu_prstr (bs->body_type)); mu_stream_printf (ostr, "%*sbody_subtype=%s\n", indent, "", - S(bs->body_subtype)); + mu_prstr (bs->body_subtype)); print_param (ostr, "Parameters", bs->body_param, indent); - mu_stream_printf (ostr, "%*sbody_id=%s\n", indent, "", S(bs->body_id)); - mu_stream_printf (ostr, "%*sbody_descr=%s\n", indent, "", S(bs->body_descr)); + mu_stream_printf (ostr, "%*sbody_id=%s\n", indent, "", + mu_prstr (bs->body_id)); + mu_stream_printf (ostr, "%*sbody_descr=%s\n", indent, "", + mu_prstr (bs->body_descr)); mu_stream_printf (ostr, "%*sbody_encoding=%s\n", indent, "", - S(bs->body_encoding)); + mu_prstr (bs->body_encoding)); mu_stream_printf (ostr, "%*sbody_size=%lu\n", indent, "", (unsigned long) bs->body_size); /* Optional */ - mu_stream_printf (ostr, "%*sbody_md5=%s\n", indent, "", S(bs->body_md5)); + mu_stream_printf (ostr, "%*sbody_md5=%s\n", indent, "", + mu_prstr (bs->body_md5)); mu_stream_printf (ostr, "%*sbody_disposition=%s\n", indent, "", - S(bs->body_disposition)); + mu_prstr (bs->body_disposition)); print_param (ostr, "Disposition Parameters", bs->body_disp_param, indent); mu_stream_printf (ostr, "%*sbody_language=%s\n", indent, "", - S(bs->body_language)); + mu_prstr (bs->body_language)); mu_stream_printf (ostr, "%*sbody_location=%s\n", indent, "", - S(bs->body_location)); + mu_prstr (bs->body_location)); mu_stream_printf (ostr, "%*sType ", indent, ""); switch (bs->body_message_type) { case mu_message_other: mu_stream_printf (ostr, "mu_message_other\n"); |