+ Hardened GetOpt library
This commit is contained in:
parent
2b907e25e1
commit
2090aeb62c
|
@ -40,7 +40,8 @@ sub get_assigned_value {
|
|||
my (%options) = @_;
|
||||
|
||||
if (!defined($options{val}) || $options{val} eq '') {
|
||||
if ($options{pos} + 1 < $options{num_args} && $ARGV[$options{pos} + 1] !~ /^--/) {
|
||||
# Add defined also. Hardened code: already see: $ARGV[6] = undef for example
|
||||
if ($options{pos} + 1 < $options{num_args} && defined($ARGV[$options{pos} + 1]) && $ARGV[$options{pos} + 1] !~ /^--/) {
|
||||
my $val = $ARGV[$options{pos} + 1];
|
||||
splice @ARGV, $options{pos} + 1, 1;
|
||||
return ($options{num_args} - 1, $val);
|
||||
|
|
Loading…
Reference in New Issue