diff --git a/changelog.txt b/changelog.txt index 8a701c080..70693e6aa 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 01/03/2014 == +demonstar55: Crash prevention for emote. + == 01/02/2014 == demonstar55: Stuns from beneficial spells (Harvest) ignore immunity diff --git a/zone/client.cpp b/zone/client.cpp index 99dec6427..6d9dd227a 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -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); -} \ No newline at end of file +} diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index b7c427c62..c0580cf59 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -7353,8 +7353,13 @@ void Client::Handle_OP_Emote(const EQApplicationPacket *app) const char* name = GetName(); uint32 len_name = strlen(name); uint32 len_msg = strlen(in->message); + // crash protection -- cheater + if (len_msg > 512) { + in->message[512] = '\0'; + len_msg = 512; + } uint32 len_packet = sizeof(in->unknown01) + len_name - + strlen(in->message) + 1; + + len_msg + 1; // Construct outgoing packet EQApplicationPacket* outapp = new EQApplicationPacket(OP_Emote, len_packet); @@ -7381,7 +7386,7 @@ void Client::Handle_OP_Emote(const EQApplicationPacket *app) } else */ - entity_list.QueueCloseClients(this, outapp, true, 100,0,true,FilterSocials); + entity_list.QueueCloseClients(this, outapp, true, 100, 0, true, FilterSocials); safe_delete(outapp); return;