Allow negative values for OptInt

[FixRM #7540]
bug/bundler_fix
James Lee 2013-01-14 14:18:56 -06:00
parent 0d34e0b249
commit bbb3fa25be
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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", },