Add some overflow protection for emotes

Clients crash if the emote is too large, despite the client
using a 1024 char buffer...
This commit is contained in:
Michael Cook (mackal)
2014-01-04 01:34:58 -05:00
parent ae68deb4f8
commit a9b4e7819f
3 changed files with 15 additions and 3 deletions
+5 -1
View File
@@ -1080,6 +1080,10 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
case 22:
{
// Emotes for Underfoot and later.
// crash protection -- cheater
if (strlen(message) > 512)
message[512] = '\0';
EQApplicationPacket* outapp = new EQApplicationPacket(OP_Emote, 4 + strlen(message) + strlen(GetName()) + 2);
Emote_Struct* es = (Emote_Struct*)outapp->pBuffer;
char *Buffer = (char *)es;
@@ -8087,4 +8091,4 @@ void Client::PlayMP3(const char* fname)
strncpy(buf->filename, fname, filename.length());
QueuePacket(outapp);
safe_delete(outapp);
}
}