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
+7 -2
View File
@@ -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;