diff --git a/lib/msf/core/option_container.rb b/lib/msf/core/option_container.rb index 5009e8be86..c66e7ea959 100644 --- a/lib/msf/core/option_container.rb +++ b/lib/msf/core/option_container.rb @@ -445,7 +445,7 @@ class OptInt < OptBase def valid?(value) return false if empty_required_value?(value) - if value and not value.to_s.match(/^0x[0-9a-fA-F]+$|^\d+$/) + if value and not value.to_s.match(/^0x[0-9a-fA-F]+$|^-?\d+$/) return false end @@ -473,7 +473,7 @@ class OptRegexp < OptBase Regexp.compile(value) return true - rescue RegexpError => e + rescue RegexpError return false end end diff --git a/spec/lib/msf/core/options/opt_int_spec.rb b/spec/lib/msf/core/options/opt_int_spec.rb index 66167de7f8..244a63fc23 100644 --- a/spec/lib/msf/core/options/opt_int_spec.rb +++ b/spec/lib/msf/core/options/opt_int_spec.rb @@ -11,7 +11,7 @@ describe Msf::OptInt do { :value => "0x0a", :normalized => 10 }, { :value => "0x0A", :normalized => 10 }, { :value => "0xFf", :normalized => 255}, - { :pending => "Redmine #7540", :value => "-1", :normalized => -1 } + { :value => "-1", :normalized => -1 }, ] invalid_values = [ { :value => "yer mom", },