summaryrefslogtreecommitdiff
path: root/src/gui/chat.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-01-21 09:18:58 -0700
committerIra Rice <irarice@gmail.com>2009-01-21 09:18:58 -0700
commitda2b9950c5785381e5e7ed541bc33dbecdb51f9c (patch)
treefaafa5fc320c2b5a02c406c12636b4c712ffa113 /src/gui/chat.cpp
parent5dff1647df4a05d956b1e1978ec8918c420b9107 (diff)
downloadmana-client-da2b9950c5785381e5e7ed541bc33dbecdb51f9c.tar.gz
mana-client-da2b9950c5785381e5e7ed541bc33dbecdb51f9c.tar.bz2
mana-client-da2b9950c5785381e5e7ed541bc33dbecdb51f9c.tar.xz
mana-client-da2b9950c5785381e5e7ed541bc33dbecdb51f9c.zip
Fixed multiple embeddings of square brackets so that it doesn't crash
the client. This commit makes it so that all brackets except for the innermost brackets are ignored. Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r--src/gui/chat.cpp7
1 files changed, 7 insertions, 0 deletions
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] == ' ')