summaryrefslogtreecommitdiff
path: root/src/bridge/bridge.cpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2015-05-11 05:43:32 +0200
committerFlorent Le Coz <louiz@louiz.org>2015-05-11 05:43:32 +0200
commit763be827c9349d39adbdd8cf731565bef316a01a (patch)
treed738a0c36653543c0ffad948b8a053390a63eb58 /src/bridge/bridge.cpp
parentcc1255d216bf7ac6029a5dd3bc8aadae06df446b (diff)
downloadbiboumi-763be827c9349d39adbdd8cf731565bef316a01a.tar.gz
biboumi-763be827c9349d39adbdd8cf731565bef316a01a.tar.bz2
biboumi-763be827c9349d39adbdd8cf731565bef316a01a.tar.xz
biboumi-763be827c9349d39adbdd8cf731565bef316a01a.zip
Fix a message.arguments size check
Diffstat (limited to 'src/bridge/bridge.cpp')
-rw-r--r--src/bridge/bridge.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp
index 8c364ee..ef20351 100644
--- a/src/bridge/bridge.cpp
+++ b/src/bridge/bridge.cpp
@@ -411,13 +411,14 @@ void Bridge::send_irc_user_ping_request(const std::string& irc_hostname, const s
irc_responder_callback_t cb = [this, nick=utils::tolower(nick), iq_id, to_jid, irc_hostname, from_jid](const std::string& hostname, const IrcMessage& message) -> bool
{
- if (irc_hostname != hostname)
+ if (irc_hostname != hostname || message.arguments.size() < 2)
return false;
IrcUser user(message.prefix);
const std::string body = message.arguments[1];
- if (message.command == "NOTICE" && utils::tolower(user.nick) == nick &&
- message.arguments.size() >= 2 && body.substr(0, 6) == "\01PING ")
+ if (message.command == "NOTICE" && utils::tolower(user.nick) == nick
+ && body.substr(0, 6) == "\01PING ")
{
+ return false;
const std::string id = body.substr(6, body.size() - 7);
if (id != iq_id)
return false;
@@ -425,8 +426,7 @@ void Bridge::send_irc_user_ping_request(const std::string& irc_hostname, const s
this->xmpp->send_iq_result(iq_id, to_jid, jid.local);
return true;
}
- if (message.command == "401" && message.arguments.size() >= 2
- && message.arguments[1] == nick)
+ if (message.command == "401" && message.arguments[1] == nick)
{
std::string error_message = "No such nick";
if (message.arguments.size() >= 3)