Send max number of characters instead of asserting in case of too long chat messages

master
sapier 2014-05-11 15:39:38 +02:00
parent 5c6cf630de
commit 167df02e3d
1 changed files with 4 additions and 2 deletions

View File

@ -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