# HG changeset patch
# User unc0rr
# Date 1226217113 0
# Node ID 51c11e77408afff6f42329fb2b04e26a353b4112
# Parent  c01512115c12d8fea4dee3ebc514a1e2424f1311
Fix chat bugs leading to serialized data corruption

diff -r c01512115c12 -r 51c11e77408a QTfrontend/proto.cpp
--- 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);
diff -r c01512115c12 -r 51c11e77408a hedgewars/uChat.pas
--- 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