From 96d48d861c2b5d894e6dcfd8acdf1b80dfbc74e5 Mon Sep 17 00:00:00 2001 From: dmiller Date: Fri, 6 Jul 2012 14:16:26 +0000 Subject: [PATCH] Fix error in http-vhosts when domain is nil ./scripts/http-vhosts.nse:502: attempt to concatenate local 'domain' (a nil value) stack traceback: ./scripts/http-vhosts.nse:502: in function 'makeTargetName' ./scripts/http-vhosts.nse:542: in function <./scripts/http-vhosts.nse:532> (...tail calls...) --- scripts/http-vhosts.nse | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/http-vhosts.nse b/scripts/http-vhosts.nse index a7794709b..2e50c406c 100644 --- a/scripts/http-vhosts.nse +++ b/scripts/http-vhosts.nse @@ -496,10 +496,17 @@ end -- @param domain string -- @return string local makeTargetName = function(name,domain) - if name == "" and domain == "" then return nil end - if name == "" then return domain end - if domain == "" then return name end - return name .. "." .. domain + if name and name ~= "" then + if domain and domain ~= "" then + return name .. "." .. domain + else + return name + end + elseif domain and domain ~= "" then + return domain + else + return nil + end end