Commit 653e0220 authored by Jan Kundrát's avatar Jan Kundrát
Browse files

When decoding from unknown encoding and assuming UTF-8, be sure to not stop at first NULL byte

This does *not* fix #321160 (this code is not even triggered in this situation),
but it's a sane thing to do anyway. I guess that the code shall be audited for
other instances where we might silently truncate the data here; it's caused by
an implicit conversion from QByteArray to uchar*.

CCBUG: 321160
parent f31d423a
......@@ -336,7 +336,7 @@ QString decodeByteArray(const QByteArray &encoded, const QString &charset)
if (QTextCodec *codec = codecForName(charset.toLatin1())) {
return codec->toUnicode(encoded);
}
return QString::fromUtf8(encoded);
return QString::fromUtf8(encoded, encoded.size());
}
/** @short Encode the given string into RFC2047 form, preserving the ASCII leading part if possible */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment