Skip to content

Commit

Permalink
Prevent multi-line chat messages server-side (#8420)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Mar 26, 2019
1 parent 38ea089 commit d0a1a29
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/server.cpp
Expand Up @@ -2874,8 +2874,13 @@ std::wstring Server::handleChat(const std::string &name, const std::wstring &wna
L"It was refused. Send a shorter message";
}

auto message = trim(wide_to_utf8(wmessage));
if (message.find_first_of("\n\r") != std::wstring::npos) {
return L"New lines are not permitted in chat messages";
}

// Run script hook, exit if script ate the chat message
if (m_script->on_chat_message(name, wide_to_utf8(wmessage)))
if (m_script->on_chat_message(name, message))
return L"";

// Line to send
Expand Down

0 comments on commit d0a1a29

Please sign in to comment.