From 02a20507cbed73323657e2db0a47e1f576e10756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Thu, 1 Jun 2023 22:05:42 +0200 Subject: [PATCH] relay: fix connection with IRC clients sending "CAP REQ :" (without capability) and not sending "CAP END" (issue #1040, issue #1796) The bug was fixed in version 2.0 (issue #1040) but a regression in version 3.7 happened while using the new IRC parser for message arguments (issue #1796, commit 96ed47126130ac62350aef4a9236009b7fc3cd5f). --- ChangeLog.adoc | 1 + src/plugins/relay/irc/relay-irc.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 929fbaf2b..1efd7878f 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -100,6 +100,7 @@ Bug fixes:: * irc: fix split of CTCP message with no arguments * irc: remove extra space in CTCP ACTION message sent without arguments * lua: fix crash with print when the value to print is not a string (issue #1904, issue #1905) + * relay: fix connection with IRC clients sending "CAP REQ :" (without capability) and not sending "CAP END" (issue #1040) * ruby: fix crash on quit when a child process is still running (issue #1889, issue #1915) * ruby: fix crash in display of exception backtrace with Ruby 3 (issue #1631, issue #1886) * script: remove trailing "J" (line feed char) in source of scripts displayed diff --git a/src/plugins/relay/irc/relay-irc.c b/src/plugins/relay/irc/relay-irc.c index d6953590c..6382142db 100644 --- a/src/plugins/relay/irc/relay-irc.c +++ b/src/plugins/relay/irc/relay-irc.c @@ -1322,6 +1322,8 @@ relay_irc_recv_command_capab (struct t_relay_client *client, server_caps = RELAY_IRC_DATA(client, server_capabilities); for (i = 1; i < num_params; i++) { + if (!params[i][0]) + continue; num_caps_received++; capability = relay_irc_search_server_capability (params[i]); if (capability >= 0)