From 9be8e4b071f5bb792fd8673092b64061c4837172 Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Tue, 8 Sep 1998 19:14:12 +0000 Subject: [PATCH] Change the interface of pgp_decrypt_mime() to enable this function to do some sanity checks. --- copy.c | 2 +- pgp.c | 5 +++++ recvattach.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/copy.c b/copy.c index 0697b85f8..24e8c6195 100644 --- a/copy.c +++ b/copy.c @@ -420,7 +420,7 @@ _mutt_copy_message (FILE *fpout, FILE *fpin, HEADER *hdr, BODY *body, BODY *cur; FILE *fp; - if (pgp_decrypt_mime (fpin, &fp, hdr->content->parts->next, &cur)) + if (pgp_decrypt_mime (fpin, &fp, hdr->content, &cur)) return (-1); fputs ("Mime-Version: 1.0\n", fpout); mutt_write_mime_header (cur, fpout); diff --git a/pgp.c b/pgp.c index 58d7348b9..e9df7fd51 100644 --- a/pgp.c +++ b/pgp.c @@ -929,6 +929,11 @@ int pgp_decrypt_mime (FILE *fpin, FILE **fpout, BODY *b, BODY **cur) if(!mutt_is_multipart_encrypted(b)) return -1; + + if(!b->parts || !b->parts->next) + return -1; + + b = b->parts->next; memset (&s, 0, sizeof (s)); s.fpin = fpin; diff --git a/recvattach.c b/recvattach.c index ca3852439..a627d16c5 100644 --- a/recvattach.c +++ b/recvattach.c @@ -813,7 +813,7 @@ void mutt_view_attachments (HEADER *hdr) if ((hdr->pgp & PGPENCRYPT) && mutt_is_multipart_encrypted(hdr->content)) { - if (pgp_decrypt_mime (msg->fp, &fp, hdr->content->parts->next, &cur)) + if (pgp_decrypt_mime (msg->fp, &fp, hdr->content, &cur)) { mx_close_message (&msg); return; -- 2.40.0