Fix chat bugs leading to serialized data corruption
authorunc0rr
Sun, 09 Nov 2008 07:51:53 +0000
changeset 1485 51c11e77408a
parent 1484 c01512115c12
child 1486 8fcc64446a97
Fix chat bugs leading to serialized data corruption
QTfrontend/proto.cpp
hedgewars/uChat.pas
--- a/QTfrontend/proto.cpp	Sat Nov 08 11:54:46 2008 +0000
+++ b/QTfrontend/proto.cpp	Sun Nov 09 07:51:53 2008 +0000
@@ -26,7 +26,7 @@
 QByteArray & HWProto::addStringToBuffer(QByteArray & buf, const QString & string)
 {
 	QByteArray strmsg = string.toUtf8();
-	strmsg.left(250);
+	strmsg = strmsg.left(250);
 	quint8 sz = strmsg.size();
 	buf.append(QByteArray((char *)&sz, 1));
 	buf.append(strmsg);
--- a/hedgewars/uChat.pas	Sat Nov 08 11:54:46 2008 +0000
+++ b/hedgewars/uChat.pas	Sun Nov 09 07:51:53 2008 +0000
@@ -185,6 +185,8 @@
 	
 	utf8:= char(Key or firstByteMark[btw]) + utf8;
 
+	if byte(InputStr.s[0]) + btw > 240 then exit;
+
 	InputStrL[byte(InputStr.s[0]) + btw]:= InputStr.s[0];
 	SetLine(InputStr, InputStr.s + utf8, true)
 	end