mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
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:
parent
ae68deb4f8
commit
a9b4e7819f
@ -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
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user