3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-23 04:19:27 +01:00

Escape single-quotes before using GetOptionsFromString and shellwords

This commit is contained in:
Pragmatic Software 2017-08-30 02:12:05 -07:00
parent 3a4eb4e5f5
commit 3b93d6c281
5 changed files with 6 additions and 3 deletions

View File

@ -890,6 +890,7 @@ sub factlog {
chomp $getopt_error;
};
$arguments =~ s/(?<!\\)'/\\'/g;
my ($show_hostmask, $actual_timestamp);
my ($ret, $args) = GetOptionsFromString($arguments,
'h' => \$show_hostmask,

View File

@ -470,7 +470,7 @@ sub expand_action_arguments {
$action =~ s/\$args/$input/g;
}
$input =~ s/'/\\'/g if defined $input;
$input =~ s/(?<!\\)'/\\'/g if defined $input;
my @args = shellwords($input);
my $const_action = $action;

View File

@ -149,6 +149,7 @@ sub list_also_known_as {
Getopt::Long::Configure ("bundling");
$arguments =~ s/(?<!\\)'/\\'/g;
my ($show_hostmasks, $show_gecos, $show_nickserv, $show_id, $show_relationship, $show_weak, $dont_use_aliases_table);
my ($ret, $args) = GetOptionsFromString($arguments,
'h' => \$show_hostmasks,
@ -241,6 +242,7 @@ sub recall_message {
foreach my $recall (@recalls) {
my ($recall_nick, $recall_history, $recall_channel, $recall_before, $recall_after, $recall_context, $recall_count);
$recall =~ s/(?<!\\)'/\\'/g;
my ($ret, $args) = GetOptionsFromString($recall,
'channel|c:s' => \$recall_channel,
'text|t|history|h:s' => \$recall_history,

View File

@ -322,6 +322,7 @@ sub show_random_quotegrab {
chomp $getopt_error;
};
$arguments =~ s/(?<!\\)'/\\'/g;
my ($ret, $args) = GetOptionsFromString($arguments,
'channel|c=s' => \$channel_search,
'text|t=s' => \$text_search);

View File

@ -209,8 +209,7 @@ sub remindme {
chomp $getopt_error;
};
$arguments =~ s/'/\\'/g;
$arguments =~ s/(?<!\\)'/\\'/g;
my ($ret, $args) = GetOptionsFromString($arguments,
'r:i' => \$repeat,
't:s' => \$alarm,