From 445eb54503fa217b3bd87272397ce1781ccaa843 Mon Sep 17 00:00:00 2001 From: Philipp Gortan Date: Mon, 30 Jun 2014 16:45:32 +0200 Subject: [PATCH] untaint --server and --port --- Makefile.PL | 3 ++- lib/App/Devbot.pm | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index a83aa86..446b493 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -19,7 +19,8 @@ WriteMakefile( POE 0 POE::Component::IRC::Plugin::AutoJoin 0 POE::Component::IRC::Plugin::NickServID 0 - POE::Component::IRC::State 0/, + POE::Component::IRC::State 0 + Regexp::Common 0/, }, META_MERGE => { dynamic_config => 0, diff --git a/lib/App/Devbot.pm b/lib/App/Devbot.pm index 1e0f5c8..d7cd700 100644 --- a/lib/App/Devbot.pm +++ b/lib/App/Devbot.pm @@ -15,11 +15,10 @@ use IRC::Utils qw/parse_user/; use Getopt::Long; use POSIX qw/strftime/; +use Regexp::Common qw /net/; ################################################## -our $VERSION; - my $nick='devbot'; my $password; my $server='irc.oftc.net'; @@ -73,7 +72,14 @@ sub bot_start{ Retry_when_banned => 60, )); - $irc->yield(register => "all"); + if ($server =~ /^($RE{net}{domain})$/) { + $server = $1; + } + if ($port =~ /^([0-9]+)$/) { + $port = $1; + } + + $irc->yield(register => "all"); $irc->yield( connect => { Nick => $nick, -- 2.39.2