From 11ad71e2fc322c8e109ffe8cd8c52332a26048bf Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 24 Jan 2016 15:08:49 +0100 Subject: Core/Misc: Fixed array out of bounds access when loading locales_achievement_reward, locales_creature_text, locales_gossip_menu_option and skip LOCALE_none when iterating over locales --- src/server/game/Chat/ChatLink.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/server/game/Chat/ChatLink.cpp') diff --git a/src/server/game/Chat/ChatLink.cpp b/src/server/game/Chat/ChatLink.cpp index d2828267662..4eeea1b20cb 100644 --- a/src/server/game/Chat/ChatLink.cpp +++ b/src/server/game/Chat/ChatLink.cpp @@ -230,6 +230,9 @@ bool ItemChatLink::ValidateName(char* buffer, const char* context) { for (uint8 index = LOCALE_koKR; index < TOTAL_LOCALES; ++index) { + if (index == LOCALE_none) + continue; + if (FormatName(index, suffixStrings) == buffer) { res = true; @@ -412,8 +415,13 @@ bool AchievementChatLink::ValidateName(char* buffer, const char* context) ChatLink::ValidateName(buffer, context); for (uint8 locale = LOCALE_enUS; locale < TOTAL_LOCALES; ++locale) + { + if (locale == LOCALE_none) + continue; + if (strcmp(_achievement->Title->Str[locale], buffer) == 0) return true; + } TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): linked achievement (id: %u) name wasn't found in any localization", context, _achievement->ID); return false; -- cgit v1.2.3