Bug 1427382 - don't use header display name straight off, in case it contains @ (analysis by Magnus Melin). r=mkmelin

This commit is contained in:
Jorg K 2018-01-03 23:22:02 +02:00
Родитель 7d87de3301
Коммит 09bacfca85
1 изменённых файлов: 14 добавлений и 3 удалений

Просмотреть файл

@ -422,10 +422,21 @@ nsMsgDBView::FetchAuthor(nsIMsgDBHdr * aHdr,
{
// We can't use the display name in the card; use the name contained in
// the header or email address.
if (!name.IsEmpty())
aSenderString = name;
else
if (name.IsEmpty()) {
CopyUTF8toUTF16(emailAddress, aSenderString);
} else {
uint32_t atPos;
if ((atPos = name.FindChar('@')) == kNotFound ||
name.FindChar('.', atPos) == kNotFound) {
aSenderString = name;
} else {
// Found @ followed by a dot, so this looks like a spoofing case.
aSenderString = name;
aSenderString.AppendLiteral(" <");
AppendUTF8toUTF16(emailAddress, aSenderString);
aSenderString.Append('>');
}
}
}
UpdateCachedName(aHdr, "sender_name", aSenderString);