Fix crash in decode() on malformed input

This commit is contained in:
Vladimir Kolesnikov 2013-02-10 16:43:24 +02:00
parent 7b42551a20
commit 968cad3328

View File

@ -48,7 +48,9 @@ QByteArray QuotedPrintable::decode(const QString &input)
QByteArray output; QByteArray output;
for (int i = 0; i < input.length(); ++i) int len = input.length();
int i;
for (i = 0; i < len-2; ++i)
{ {
if (input.at(i).toLatin1() == '=') if (input.at(i).toLatin1() == '=')
{ {
@ -61,5 +63,10 @@ QByteArray QuotedPrintable::decode(const QString &input)
} }
} }
while (i<len) {
output.append(input.at(i).toLatin1());
++i;
}
return output; return output;
} }