From 71e43ba49e51ce1e2dc737d6e864b851fd9a41df Mon Sep 17 00:00:00 2001 From: troubled-irc Date: Tue, 13 Mar 2007 04:55:19 +0000 Subject: [PATCH] Fixed bug in "+sed" by enforcing limit on output when using s///g git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@1319 c11ca15a-4712-0410-83d8-924469b57eb5 --- ChangeLog | 6 ++++++ src/IRC/IrcHelpers.pl | 2 ++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index d3ffba8..3257231 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-03-13 troubled + + * src/IRC/IrcHelpers.pl: Fixed bug in "+sed" that caused the bot + to flood itself off the network when passed large s///g;. A + temporary limit of 255 charaters on the output has been enabled. + 2007-03-11 22:00 troubled * src/{Process.pl,UserExtra.pl}: Fixed bug with karma stats. It diff --git a/src/IRC/IrcHelpers.pl b/src/IRC/IrcHelpers.pl index 7e273d6..cc53742 100644 --- a/src/IRC/IrcHelpers.pl +++ b/src/IRC/IrcHelpers.pl @@ -236,6 +236,8 @@ sub hookMsg { $orig{message} =~ /^s\/([^;\/]*)\/([^;\/]*)\/([g]*)$/) { my $sedmsg = $seencache{$who}{'msg'}; eval "\$sedmsg =~ s/\Q$1\E/\Q$2\E/$3;"; + $sedmsg =~ s/^(.{255}).*$/$1.../; # 255 char max to prevent flood + if ($sedmsg ne $seencache{$who}{'msg'}) { &DEBUG("sed \"" . $orig{message} . "\" \"" . $seencache{$who}{'msg'} . "\" \"" . $sedmsg. "\""); -- 2.39.2