fix use of uninitialized value in escapeshellparam()

This commit is contained in:
root 2018-04-25 15:18:00 -04:00
parent 4ebc0abef5
commit 2732392088
1 changed files with 6 additions and 3 deletions

View File

@ -1087,11 +1087,14 @@ sub getdate {
}
sub escapeshellparam {
my $par;
if (scalar @_) {
($par) = @_;
my ($par) = @_;
# avoid use of uninitialized string in regex
if (length($par)) {
# "escape" all single quotes
$par =~ s/'/'"'"'/g;
} else {
# avoid use of uninitialized string in concatenation below
$par = '';
}
# single-quote entire string
return "'$par'";