mirror of
https://github.com/nmap/nmap.git
synced 2026-08-27 03:48:14 +00:00
Avoid TOCTOU by checking discovery state in mssql.Discover
A script might check WasDiscoveryPerformed and get a negative response, then call Discover, during which time another script already called Discover. Instead, check the condition *after* acquiring the mutex.
This commit is contained in:
parent
0b7dc80349
commit
02c0354744
3 changed files with 12 additions and 14 deletions
|
|
@ -254,9 +254,7 @@ action = function( host )
|
|||
local status, instanceList = mssql.Helper.GetTargetInstances( host )
|
||||
-- if no instances were targeted, then display info on all
|
||||
if ( not status ) then
|
||||
if ( not mssql.Helper.WasDiscoveryPerformed( host ) ) then
|
||||
mssql.Helper.Discover( host )
|
||||
end
|
||||
mssql.Helper.Discover( host )
|
||||
instanceList = mssql.Helper.GetDiscoveredInstances( host )
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue