1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-30 11:29:01 +00:00

Fix NSE error: attempt to get length of a number

NSE: Script Engine Scan Aborted.
An error was thrown by the engine: attempt to get length of a number
value
stack traceback:
        [C]: in function 'port_set_output'
        /home/rt/builds/nmap/nse_main.lua:314: in function 'set_output'
        /home/rt/builds/nmap/nse_main.lua:947: in function 'run'
        /home/rt/builds/nmap/nse_main.lua:1330: in function
</home/rt/builds/nmap/nse_main.lua:1237>
        [C]: in ?

This now allows return of anything stringifiable as second return value
without crashing (though this may not be what the script author intends,
better to not crash)
This commit is contained in:
dmiller
2012-08-23 18:45:42 +00:00
parent a49667aa02
commit c3f88169a4

View File

@@ -297,7 +297,7 @@ do
local tab, str
if r2 then
tab, str = r1, r2;
tab, str = r1, tostring(r2);
elseif type(r1) == "string" then
tab, str = nil, r1;
elseif r1 == nil then