From 3af9d0ac67377c5b7535415696d73bd470aa08f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Fri, 21 Apr 2017 22:55:24 +0200 Subject: [PATCH] =?UTF-8?q?Make=20sure=20we=20don=E2=80=99t=20exceed=20512?= =?UTF-8?q?=20bytes=20when=20grouping=20JOINs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/irc/irc_client.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp index ea5afd2..90fad75 100644 --- a/src/irc/irc_client.cpp +++ b/src/irc/irc_client.cpp @@ -858,6 +858,12 @@ void IrcClient::on_welcome_message(const IrcMessage& message) continue; if (!key.empty()) { + if (keys.size() + channels_with_key.size() >= 300) + { // Arbitrary size, to make sure we never send more than 512 + this->send_join_command(channels_with_key, keys); + channels_with_key.clear(); + keys.clear(); + } if (!keys.empty()) keys += ","; keys += key; @@ -867,6 +873,11 @@ void IrcClient::on_welcome_message(const IrcMessage& message) } else { + if (channels.size() >= 300) + { // Arbitrary size, to make sure we never send more than 512 + this->send_join_command(channels, {}); + channels.clear(); + } if (!channels.empty()) channels += ","; channels += chan; -- 2.45.2