зеркало из https://github.com/mozilla/gecko-dev.git
bug 227290 : be generous to overlong (invalid) B-encoded words in RFC 2047 encoded header (r=smontagu, sr=bienvenu)
This commit is contained in:
Родитель
222146a4bc
Коммит
05377e6a08
|
@ -701,8 +701,13 @@ nsresult DecodeRFC2047Str(const char *aHeader, const char *aDefaultCharset,
|
|||
|
||||
if(*q == 'Q' || *q == 'q')
|
||||
decodedText = DecodeQ(q + 2, r - (q + 2));
|
||||
else
|
||||
decodedText = PL_Base64Decode(q + 2, r - (q + 2), nsnull);
|
||||
else {
|
||||
// bug 227290. ignore an extraneous '=' at the end.
|
||||
// (# of characters in B-encoded part has to be a multiple of 4)
|
||||
PRInt32 n = r - (q + 2);
|
||||
n -= (n % 4 == 1 && !PL_strncmp(r - 3, "===", 3)) ? 1 : 0;
|
||||
decodedText = PL_Base64Decode(q + 2, n, nsnull);
|
||||
}
|
||||
|
||||
if (decodedText == nsnull)
|
||||
goto badsyntax;
|
||||
|
|
Загрузка…
Ссылка в новой задаче