mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 13:11:28 +00:00
Fix for scripts returning multiple results causing the getting of the script's
ID to fail.
This commit is contained in:
12
nse_main.cc
12
nse_main.cc
@@ -436,14 +436,12 @@ int process_mainloop(lua_State *L) {
|
|||||||
// then we release the thread and remove it from the
|
// then we release the thread and remove it from the
|
||||||
// running_scripts list
|
// running_scripts list
|
||||||
|
|
||||||
if(lua_isstring (current.thread, -1)) { // FIXME
|
if(lua_isstring (current.thread, 2)) { // FIXME
|
||||||
ScriptResult sr;
|
ScriptResult sr;
|
||||||
lua_State *thread = current.thread;
|
lua_State *thread = current.thread;
|
||||||
SCRIPT_ENGINE_TRY(process_getScriptId(thread, &sr));
|
SCRIPT_ENGINE_TRY(process_getScriptId(thread, &sr));
|
||||||
lua_getglobal(thread, "string");
|
lua_getfield(thread, 2, "gsub");
|
||||||
lua_getfield(thread, -1, "gsub");
|
lua_pushvalue(thread, 2); // output FIXME
|
||||||
lua_replace(thread, -2); // remove string table
|
|
||||||
lua_pushvalue(thread, -2); // output FIXME
|
|
||||||
lua_pushliteral(thread, "[^%w%s%p]");
|
lua_pushliteral(thread, "[^%w%s%p]");
|
||||||
lua_pushcclosure(thread, escape_char, 0);
|
lua_pushcclosure(thread, escape_char, 0);
|
||||||
lua_call(thread, 3, 1);
|
lua_call(thread, 3, 1);
|
||||||
@@ -543,8 +541,8 @@ int process_waiting2running(lua_State* L, int resume_arguments) {
|
|||||||
* */
|
* */
|
||||||
int process_getScriptId(lua_State* L, ScriptResult *sr) {
|
int process_getScriptId(lua_State* L, ScriptResult *sr) {
|
||||||
|
|
||||||
lua_getfield(L, -2, ID);
|
lua_getfield(L, 1, ID);
|
||||||
lua_getfield(L, -3, FILENAME);
|
lua_getfield(L, 1, FILENAME);
|
||||||
|
|
||||||
if(lua_isstring(L, -2)) {
|
if(lua_isstring(L, -2)) {
|
||||||
sr->set_id(lua_tostring (L, -2));
|
sr->set_id(lua_tostring (L, -2));
|
||||||
|
|||||||
Reference in New Issue
Block a user