qt-bugs@ issue : N175791
bugs.kde.org number :
applied: yes
author: mueller@kde.org

fixes an off-by-one buffer overflow in the utf8 decoder


--- src/codecs/qutfcodec.cpp
+++ src/codecs/qutfcodec.cpp
@@ -164,7 +164,7 @@ public:
     QString toUnicode(const char* chars, int len)
     {
 	QString result;
-	result.setLength( len ); // worst case
+	result.setLength( len + 1 ); // worst case
 	QChar *qch = (QChar *)result.unicode();
 	uchar ch;
 	for (int i=0; i<len; i++) {
