Nmap Development mailing list archives

Re: Script database update error


From: David Fifield <david () bamsoftware com>
Date: Tue, 12 Jan 2010 10:54:41 -0700

On Tue, Jan 12, 2010 at 02:08:52PM +0000, jah wrote:
On 12/01/2010 13:53, Tom Sellers wrote:
Starting Nmap 5.10BETA2 ( http://nmap.org ) at 2010-01-12 07:47 CST
NSE: Updating rule database.
NSE: error while updating Script Database:
[string "local nse = ......"]:17:
/usr/local/share/nmap/nselib/http.lua:45: attempt to index field
'args' (a nil value)
stack traceback:
        [C]: in function 'assert'
        [string "local nse = ......"]:17: in main chunk 
It looks to be because, during an update, the args table doesn't exist
and so an attempt to index it causes an exception.
The attached patch is a quick fix.

Regards,

jah

--- http.lua.orig     2010-01-12 14:03:38.119000000 +0000
+++ http.lua  2010-01-12 14:02:30.681500000 +0000
@@ -41,7 +41,7 @@
 local have_ssl = (nmap.have_ssl() and pcall(require, "openssl"))
 
 local USER_AGENT
-do
+if nmap.registry.args then
   local arg = nmap.registry.args["http.useragent"]
   if arg and arg == "" then
     USER_AGENT = nil

Thanks, guys. I applied jah's patch with a little change, so that if the
args table doesn't exist, USER_AGENT gets it default "Mozilla" value,
not nil. However I don't think that situation could arise during normal
script execution.

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: