Currently mutt truncates long filenames in attachments and doesn't
take into account UTF-8 character size. If filename is truncated in
the middle of multi-byte UTF-8 character (last character is bad),
then some mail clients assume whole attachment name bad and don't
display its name (use 'Noname' instead).
Filenames can be up to 255 *characters* long depending on used
filesystem. ReiserFS, NFTS, FAT, APFS and some other supports up to
255 characters.
In the worst case 255 characters in UTF-8 will take 255*4 = 1020
bytes. Every non-ascii byte in the filename will be encoded using 3
bytes (for example, %8D).
So 'Content-Disposition' will take in the worst case up to: 1020*3 =
3060 bytes. Therefore even LONG_STRING (1024) isn't enough.
Co-authored-by: Richard Russon <rich@flatcap.org>
fputc(';', fp);
- char buf[256];
- buf[0] = '\0';
+ char buf[8192] = { 0 };
tmp = mutt_str_strdup(np->value);
const int encode = rfc2231_encode_string(&tmp);
mutt_addr_cat(buf, sizeof(buf), tmp, MimeSpecials);