summaryrefslogtreecommitdiffabout
path: root/mu/libexec/imap.c
authorSergey Poznyakoff <gray@gnu.org.ua>2017-10-10 09:54:52 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2017-10-10 09:54:52 (GMT)
commit5589f8787925cb3b05078ecfd55c54b36aed637d (patch) (side-by-side diff)
tree0e626e7d233e5a03fe7aadf6c67a276dcb811de1 /mu/libexec/imap.c
parent090c7b9a38373ec605535b9bf22ecce2a1433c17 (diff)
downloadmailutils-5589f8787925cb3b05078ecfd55c54b36aed637d.tar.gz
mailutils-5589f8787925cb3b05078ecfd55c54b36aed637d.tar.bz2
Use mu_prtstr to safely print string values
Diffstat (limited to 'mu/libexec/imap.c') (more/less context) (ignore whitespace changes)
-rw-r--r--mu/libexec/imap.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/mu/libexec/imap.c b/mu/libexec/imap.c
index 37d494a..b447576 100644
--- a/mu/libexec/imap.c
+++ b/mu/libexec/imap.c
@@ -203,7 +203,6 @@ format_date (mu_stream_t str, char *name,
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,
@@ -269,7 +268,8 @@ print_imapenvelope (mu_stream_t ostr, struct mu_imapenvelope *env, int level)
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);
@@ -277,34 +277,38 @@ print_imapenvelope (mu_stream_t ostr, struct mu_imapenvelope *env, int level)
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)

Return to:

Send suggestions and report system problems to the System administrator.