From: Kevin McCarthy Date: Fri, 21 Dec 2018 18:13:17 +0000 (-0800) Subject: Handle improperly encoded pgp/mime octetstream part. X-Git-Tag: mutt-1-11-2-rel~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eb444e639540c1cd571829e3eb7640dc7febb5ec;p=mutt Handle improperly encoded pgp/mime octetstream part. 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) --- diff --git a/crypt-gpgme.c b/crypt-gpgme.c index 47be23bb..1ec05497 100644 --- a/crypt-gpgme.c +++ b/crypt-gpgme.c @@ -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; diff --git a/handler.c b/handler.c index 7ce53f95..c332e1fe 100644 --- 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 be182735..6f5c8077 100644 --- 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;