Skip to content

Commit

Permalink
Send max number of characters instead of asserting in case of too lon…
Browse files Browse the repository at this point in the history
…g chat messages
  • Loading branch information
sapier authored and sapier committed May 11, 2014
1 parent 5c6cf63 commit 167df02
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/client.cpp
Expand Up @@ -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
Expand Down

0 comments on commit 167df02

Please sign in to comment.