From 5c729e65c91932249cffd27fc99d198fbb4b365d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 1 Feb 2015 01:05:39 -0600 Subject: [PATCH] Add sanity checks to GMSayHookCallBackProcess --- zone/zone.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/zone/zone.h b/zone/zone.h index 28d25b5de..80e0473f2 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -257,7 +257,14 @@ public: // random object that provides random values for the zone EQEmu::Random random; - static void GMSayHookCallBackProcess(uint16 log_category, const std::string& message){ + static void GMSayHookCallBackProcess(uint16 log_category, std::string message){ + /* Cut messages down to 4000 max to prevent client crash */ + if (!message.empty()) + message = message.substr(0, 4000); + + /* Replace Occurrences of % or MessageStatus will crash */ + find_replace(message, std::string("%"), std::string(".")); + if (message.find("\n") != std::string::npos){ auto message_split = SplitString(message, '\n'); entity_list.MessageStatus(0, 80, Log.GetGMSayColorFromCategory(log_category), "%s", message_split[0].c_str());