Nmap Development mailing list archives

Re: [NSE] assertion failure in stdnse.sleep()


From: David Fifield <david () bamsoftware com>
Date: Wed, 21 Nov 2012 22:51:45 -0800

On Thu, Nov 15, 2012 at 09:10:52PM -0500, Patrick Donnelly wrote:
Hi Henri,

On Tue, Nov 6, 2012 at 7:43 AM, Henri Doreau <henri.doreau () gmail com> wrote:
what's the status concerning this issue?

With your patch I can still reproduce a similar crash by doing the following
(strange) steps:

1: Patch a random script to make it sleep for a while
Index: scripts/ssh-hostkey.nse
===================================================================
--- scripts/ssh-hostkey.nse     (revision 30204)
+++ scripts/ssh-hostkey.nse     (working copy)
@@ -127,6 +127,8 @@
   local format = nmap.registry.args.ssh_hostkey or "hex"
   local all_formats = format:find( 'all', 1, true )

+  stdnse.sleep(3)
+
   key = ssh1.fetch_host_key( host, port )
   if key then table.insert( keys, key ) end

2: Run
./nmap --script ssh-hostkey --host-timeout 2s localhost
Starting Nmap 6.02 ( http://nmap.org )
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00026s latency).
Skipping host localhost (127.0.0.1) due to host timeout
Nmap done: 1 IP address (1 host up) scanned in 2.19 seconds
nmap: nse_nsock.cc:710: void sleep_callback(void*, void*, void*): Assertion
`lua_status(L) == 1' failed.

Right, my patch wasn't intended to solve this particular bug. There
needs to be a destructor for the sleep function to cancel the nsock
timer event. I'll hopefully have a patch ready for this by the week's
end.

Thanks for the nudge Henri! =)

Do you have a patch for this, Patrick? I started looking into it myself,
but it started to be more complicated than I anticipated. I'm happy to
let you do it if you've already started.

David Fifield
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: