]> granicus.if.org Git - neomutt/commitdiff
Fix mutt_write_mime_body() application/pgp-encrypted handling
authorKevin McCarthy <kevin@8t8.us>
Tue, 10 Sep 2019 01:32:59 +0000 (18:32 -0700)
committerRichard Russon <rich@flatcap.org>
Tue, 8 Oct 2019 16:43:58 +0000 (17:43 +0100)
It would blindly overwrite any attachment with that type, as if it
were the version label part of a multipart/encrypted message.

However attachments with extenstion .gpg are labeled that type if
$mime_type_query_command is set to "xdg-mime query filetype".  This
would cause the attachment to be overwritten too.

Add a check for a missing body->filename, which should only be the
case for the manually constructed part.

Co-authored-by: Richard Russon <rich@flatcap.org>
sendlib.c

index 95b748a99d30ea1a0a7937608b1532c42f857fc3..bf004b33fb2e5c052398f13afd0bb8264e61e6f7 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -550,8 +550,8 @@ int mutt_write_mime_body(struct Body *a, FILE *fp)
   }
 
   /* This is pretty gross, but it's the best solution for now... */
-  if (((WithCrypto & APPLICATION_PGP) != 0) && (a->type == TYPE_APPLICATION) &&
-      (mutt_str_strcmp(a->subtype, "pgp-encrypted") == 0))
+  if ((WithCrypto & APPLICATION_PGP) && (a->type == TYPE_APPLICATION) &&
+      (mutt_str_strcmp(a->subtype, "pgp-encrypted") == 0) && !a->filename)
   {
     fputs("Version: 1\n", fp);
     return 0;