From: sapier Date: Sun, 11 May 2014 13:39:38 +0000 (+0200) Subject: Send max number of characters instead of asserting in case of too long chat messages X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=167df02e3d69dd0e8c8915944e6bab00417b15d5;p=zefram%2Fminetest%2Fminetest_engine.git Send max number of characters instead of asserting in case of too long chat messages --- diff --git a/src/client.cpp b/src/client.cpp index 871209a1..6b507226 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -2082,8 +2082,10 @@ void Client::sendChatMessage(const std::wstring &message) // Write length size_t messagesize = message.size(); - assert(messagesize <= 0xFFFF); - writeU16(buf, (u16) (messagesize & 0xFFFF)); + if (messagesize > 0xFFFF) { + messagesize = 0xFFFF; + } + writeU16(buf, (u16) messagesize); os.write((char*)buf, 2); // Write string