mirror of
https://github.com/nmap/nmap.git
synced 2026-01-16 03:19:01 +00:00
Make nse_selectedbyname return false if the "NSE_SELECTED_BY_NAME" key
is not in the registry. That function is called indirectly by
nmap.verbosity, which may be called before _R["NSE_SELECTED_BY_NAME"]
has been given a value. I was getting this error with any script scan:
NSE: failed to initialize the script engine:
attempt to call a nil value
stack traceback:
[C]: in function 'verbosity'
./nse_main.lua:136: in function 'print_verbose'
./nse_main.lua:680: in main chunk
[C]: ?
QUITTING!
This commit is contained in:
@@ -533,7 +533,12 @@ void nse_base (lua_State *L)
|
||||
void nse_selectedbyname (lua_State *L)
|
||||
{
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, NSE_SELECTED_BY_NAME);
|
||||
lua_call(L, 0, 1); /* returns boolean, whether script was selected by name */
|
||||
if (lua_isnil(L, -1)) {
|
||||
lua_pushboolean(L, 0);
|
||||
lua_replace(L, -2);
|
||||
} else {
|
||||
lua_call(L, 0, 1); /* returns boolean, whether script was selected by name */
|
||||
}
|
||||
}
|
||||
|
||||
static lua_State *L_NSE = NULL;
|
||||
|
||||
Reference in New Issue
Block a user