Geary.RFC822.MailboxAddress: Handle long headers being folded

Remove "\n " sequences from RFC822 text before decoding so that any
long mailboxes/mailbox lists folded before the 80 char limit are
unfolded.

Fixes #1009
This commit is contained in:
Michael Gratton 2021-01-20 19:22:46 +11:00
parent b51b933b6d
commit 3c4d5c5e9d
2 changed files with 18 additions and 9 deletions

View file

@ -234,12 +234,21 @@ class Geary.RFC822.MailboxAddressTest : TestCase {
assert(new MailboxAddress("test", "example@example@example.com").is_spoofed() == true);
assert(new MailboxAddress("'prefix-example@example.com'", "example@example.com").is_spoofed() == true);
try {
assert(new MailboxAddress.from_rfc822_string("\"=?utf-8?b?dGVzdCIgPHBvdHVzQHdoaXRlaG91c2UuZ292Pg==?==?utf-8?Q?=00=0A?=\" <demo@mailsploit.com>")
.is_spoofed() == true);
} catch (Error err) {
assert_no_error(err);
}
assert_false(
new MailboxAddress.from_rfc822_string(
"hello\n there <example@example.com>"
).is_spoofed()
);
assert_false(
new MailboxAddress.from_rfc822_string(
"\"hello\n there\" <example@example.com>"
).is_spoofed()
);
assert_true(
new MailboxAddress.from_rfc822_string(
"\"=?utf-8?b?dGVzdCIgPHBvdHVzQHdoaXRlaG91c2UuZ292Pg==?==?utf-8?Q?=00=0A?=\" <demo@mailsploit.com>"
).is_spoofed()
);
}
public void to_full_display() throws GLib.Error {