mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 07:34:35 +02:00
+ Hardened GetOpt library
This commit is contained in:
parent
6401fc07d2
commit
f939caf8f5
@ -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…
x
Reference in New Issue
Block a user