mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 14:49:29 +00:00
Fix a bug in creds.lua, comparing creds without users
When creds.lua is used without usernames (like in snmp-brute.nse), the credentials could not be sorted because they are sorted first by username, which is nil and cannot be compared. Now the script first checks that both values are non-nil (and true) before comparing them.
This commit is contained in:
parent
0f602cbd38
commit
63ad40fb74
1 changed files with 3 additions and 3 deletions
|
|
@ -266,11 +266,11 @@ Account = {
|
|||
--
|
||||
-- Lexicographic comparison by user, pass, and state
|
||||
__lt = function (a, b)
|
||||
if a.user >= b.user then
|
||||
if a.user and b.user and a.user >= b.user then
|
||||
return false
|
||||
elseif a.pass >= b.pass then
|
||||
elseif a.pass and b.pass and a.pass >= b.pass then
|
||||
return false
|
||||
elseif a.state >= b.state then
|
||||
elseif a.state and b.state and a.state >= b.state then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue