mirror of
https://github.com/nmap/nmap.git
synced 2026-01-04 13:49:03 +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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user