]> granicus.if.org Git - mutt/commitdiff
Handle improperly encoded pgp/mime octetstream part.
authorKevin McCarthy <kevin@8t8.us>
Fri, 21 Dec 2018 18:13:17 +0000 (10:13 -0800)
committerKevin McCarthy <kevin@8t8.us>
Thu, 27 Dec 2018 23:46:50 +0000 (15:46 -0800)
Some clients (or even mail servers) improperly encode the octetstream
part.

Thanks to Riccardo Schirone for the original merge request patch.
This commit also handles the attachment menu, and makes the decoding
conditional so it's not done if it isn't necessary.

(cherry picked from commit 450de4637f6590487a073b250da342a1400a3ac3)

crypt-gpgme.c
handler.c
pgp.c

index 47be23bb103fe02c9061a6bd97378f60dda998f4..1ec0549747214ca36eaab4d0355302a4873acb21 100644 (file)
@@ -1843,7 +1843,12 @@ int pgp_gpgme_decrypt_mime (FILE *fpin, FILE **fpout, BODY *b, BODY **cur)
   first_part->warnsig = 0;
 
   if (mutt_is_valid_multipart_pgp_encrypted (b))
+  {
     b = b->parts->next;
+    /* Some clients improperly encode the octetstream part. */
+    if (b->encoding != ENC7BIT)
+      need_decode = 1;
+  }
   else if (mutt_is_malformed_multipart_pgp_encrypted (b))
   {
     b = b->parts->next->next;
index 7ce53f957d5ea02953edc8bc0fb03a62c8f7252b..c332e1fef29cd9f867b16216c4e4addaf3abe6f1 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -1695,7 +1695,11 @@ static int valid_pgp_encrypted_handler (BODY *b, STATE *s)
   BODY *octetstream;
 
   octetstream = b->parts->next;
-  rc = crypt_pgp_encrypted_handler (octetstream, s);
+  /* Some clients improperly encode the octetstream part. */
+  if (octetstream->encoding != ENC7BIT)
+    rc = run_decode_and_handler (octetstream, s, crypt_pgp_encrypted_handler, 0);
+  else
+    rc = crypt_pgp_encrypted_handler (octetstream, s);
   b->goodsig |= octetstream->goodsig;
 
   return rc;
diff --git a/pgp.c b/pgp.c
index be1827355b2fc1a57f64ed30c306e920495c8002..6f5c80777c513c3ac5e0afbdbc384f1bdd94f822 100644 (file)
--- a/pgp.c
+++ b/pgp.c
@@ -1044,7 +1044,12 @@ int pgp_decrypt_mime (FILE *fpin, FILE **fpout, BODY *b, BODY **cur)
   int rv = 0;
 
   if (mutt_is_valid_multipart_pgp_encrypted (b))
+  {
     b = b->parts->next;
+    /* Some clients improperly encode the octetstream part. */
+    if (b->encoding != ENC7BIT)
+      need_decode = 1;
+  }
   else if (mutt_is_malformed_multipart_pgp_encrypted (b))
   {
     b = b->parts->next->next;