From 62aa04c11a60a9f7929ad0fb67d7b21e169bf016 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 27 Feb 2009 20:16:29 +0000 Subject: [PATCH] In dns-zone-transfer.nse, return "" in case domain decoding fails. otherwise there is an assertion failure trying to insert a nil into an output table in tab.lua. Increase the maximum number of message compression pointers we will follow in dns.lua from 3 to 10, because Brandon found a server that used 4.. --- nselib/dns.lua | 2 +- scripts/dns-zone-transfer.nse | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/nselib/dns.lua b/nselib/dns.lua index d404695da..36e71794c 100644 --- a/nselib/dns.lua +++ b/nselib/dns.lua @@ -486,7 +486,7 @@ function decStr(data, pos) local part -- Avoid infinite recursion on malformed compressed messages. - limit = limit or 3 + limit = limit or 10 if limit < 0 then return pos, nil end diff --git a/scripts/dns-zone-transfer.nse b/scripts/dns-zone-transfer.nse index 8557d44d0..5a798e1f3 100644 --- a/scripts/dns-zone-transfer.nse +++ b/scripts/dns-zone-transfer.nse @@ -123,7 +123,9 @@ end --@param data String of data. --@param offset Offset in the string to read the domain name. function parse_domain(data, offset) - return dns.decStr(data, offset) + local offset, domain = dns.decStr(data, offset) + domain = domain or "" + return offset, domain end --- Build RFC 1035 root domain name from the name of the DNS server