summaryrefslogtreecommitdiff
path: root/src/irc/core/ctcp.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-06-27 21:26:33 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-06-27 21:26:33 +0000
commitf98b77c4a2c9d7b230dc69835c1fbfa8fcc55dda (patch)
treeb7b355341c0cd94997da8dd4fe5971ed5820a45c /src/irc/core/ctcp.c
parent31794553e604701e1dfd88398cfd074ce8f89acb (diff)
downloadirssi-f98b77c4a2c9d7b230dc69835c1fbfa8fcc55dda.zip
Don't reply to CTCP PINGs longer than 100 bytes (see the comment).
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1578 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc/core/ctcp.c')
-rw-r--r--src/irc/core/ctcp.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/irc/core/ctcp.c b/src/irc/core/ctcp.c
index 917a9903..88261800 100644
--- a/src/irc/core/ctcp.c
+++ b/src/irc/core/ctcp.c
@@ -73,6 +73,21 @@ static void ctcp_ping(IRC_SERVER_REC *server, const char *data,
g_return_if_fail(server != NULL);
g_return_if_fail(nick != NULL);
+ if (strlen(data) > 100) {
+ /* Yes, this is kind of a kludge, but people who PING you
+ with messages this long deserve not to get the reply.
+
+ The problem with long messages is that when you send lots
+ of data to server, it's input buffer gets full and you get
+ killed from server because of "excess flood".
+
+ Irssi's current flood protection doesn't count the message
+ length, but even if it did, the CTCP flooder would still
+ be able to at least slow down your possibility to send
+ messages to server. */
+ return;
+ }
+
str = g_strdup_printf("NOTICE %s :\001PING %s\001", nick, data);
ctcp_send_reply(server, str);
g_free(str);