wrong option parsing for "make" fixed

This commit is contained in:
lars 2006-05-06 04:17:09 +00:00
parent 5482e5a4db
commit 1c56dffeb5

View file

@ -91,10 +91,16 @@ sub make {
my $commandline = ''; my $commandline = '';
$commandline = '-' . $list{'-switches'} if(defined($list{'-switches'})); $commandline = '-' . $list{'-switches'} if(defined($list{'-switches'}));
my @commandline; my @commandline;
# UGLY! foreach (&quotewords('\s+', 1, $commandline)) {
foreach (split(/["'](.+?)["']|(\s-\w+)/, $commandline)) { next if (!defined($_));
next if (!defined($_) or !$_ or $_ eq ' '); # untaint input
push @commandline, $_; $_ =~ s/['"]//g;
$_ =~ m/^([\w _\/,\.\@:'"-]*)$/;
if ($_ =~ /^\s*$/) {
push @commandline, "";
} else {
push @commandline, $1;
}
} }
# These three variables are essential # These three variables are essential
@ -148,19 +154,12 @@ sub update {
$switches = '-e' . $switches; $switches = '-e' . $switches;
my @switch_list; my @switch_list;
# UGLY!
#foreach (split(/["'](.+?)["']|(-\w+)/, $switches)) {
# next if (!defined($_));
# # untaint input
# $_ =~ m/^([\w _\/,\.\@:'"-]*)$/;
# push @switches, $1;
#}
foreach (&quotewords('\s+', 1, $switches)) { foreach (&quotewords('\s+', 1, $switches)) {
next if (!defined($_)); next if (!defined($_));
# untaint input # untaint input
$_ =~ s/['"]//g; $_ =~ s/['"]//g;
$_ =~ m/^([\w _\/,\.\@:'"-]*)$/; $_ =~ m/^([\w _\/,\.\@:'"-]*)$/;
if ($_ eq '') { if ($_ =~ /^\s*$/) {
push @switch_list, ""; push @switch_list, "";
} else { } else {
push @switch_list, $1; push @switch_list, $1;