diff --git a/zone/client.cpp b/zone/client.cpp index cfe7d3eeb..114550ebc 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -1082,10 +1082,12 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s { // Emotes for Underfoot and later. // crash protection -- cheater - if (strlen(message) > 512) + message[1023] = '\0'; + size_t msg_len = strlen(message); + if (msg_len > 512) message[512] = '\0'; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Emote, 4 + strlen(message) + strlen(GetName()) + 2); + EQApplicationPacket* outapp = new EQApplicationPacket(OP_Emote, 4 + msg_len + strlen(GetName()) + 2); Emote_Struct* es = (Emote_Struct*)outapp->pBuffer; char *Buffer = (char *)es; Buffer += 4; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 25e5e04f9..010d66fcb 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -7361,6 +7361,8 @@ void Client::Handle_OP_Emote(const EQApplicationPacket *app) // Calculate new packet dimensions Emote_Struct* in = (Emote_Struct*)app->pBuffer; + in->message[1023] = '\0'; + const char* name = GetName(); uint32 len_name = strlen(name); uint32 len_msg = strlen(in->message); @@ -11624,6 +11626,7 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app) } GMSearchCorpse_Struct *gmscs = (GMSearchCorpse_Struct *)app->pBuffer; + gmscs->Name[63] = '\0'; char errbuf[MYSQL_ERRMSG_SIZE]; char* Query = 0;