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 { sub escapeshellparam {
my $par; my ($par) = @_;
if (scalar @_) { # avoid use of uninitialized string in regex
($par) = @_; if (length($par)) {
# "escape" all single quotes # "escape" all single quotes
$par =~ s/'/'"'"'/g; $par =~ s/'/'"'"'/g;
} else {
# avoid use of uninitialized string in concatenation below
$par = '';
} }
# single-quote entire string # single-quote entire string
return "'$par'"; return "'$par'";