summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/being.cpp7
-rw-r--r--src/gui/chat.cpp7
2 files changed, 14 insertions, 0 deletions
diff --git a/src/being.cpp b/src/being.cpp
index c5a98a2d..8ed66c7a 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -187,6 +187,13 @@ void Being::setSpeech(const std::string &text, Uint32 time)
while (start != std::string::npos && end != std::string::npos)
{
+ // Catch multiple embeds and ignore them so it doesn't crash the client.
+ while ((mSpeech.find('[', start + 1) != std::string::npos) &&
+ (mSpeech.find('[', start + 1) < end))
+ {
+ start = mSpeech.find('[', start + 1);
+ }
+
std::string::size_type position = mSpeech.find('|');
mSpeech.erase(end, 1);
mSpeech.erase(start, (position - start) + 1);
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index ef625753..a0f12b2c 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -363,6 +363,13 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg)
std::string::size_type end = msg.find(']', start);
if (end != std::string::npos)
{
+ // Catch multiple embeds and ignore them so it doesn't crash the client.
+ while ((msg.find('[', start + 1) != std::string::npos) &&
+ (msg.find('[', start + 1) < end))
+ {
+ start = msg.find('[', start + 1);
+ }
+
std::string temp = msg.substr(start+1, end - start - 1);
while (temp[0] == ' ')