From 709fce67b14d3b8cbe4bca967a1248b8fd55036f Mon Sep 17 00:00:00 2001 From: patrik Date: Fri, 15 Jun 2012 10:07:32 +0000 Subject: [PATCH] Applied patches from Dan Miller to fix bugs in http and sslcert libraries; http://seclists.org/nmap-dev/2012/q2/696 --- nselib/http.lua | 3 +++ nselib/sslcert.lua | 3 +++ 2 files changed, 6 insertions(+) diff --git a/nselib/http.lua b/nselib/http.lua index e3f4430a6..1e01855df 100644 --- a/nselib/http.lua +++ b/nselib/http.lua @@ -1334,6 +1334,9 @@ local function parse_redirect(host, port, path, response) u.host, u.port = stdnse.get_hostname(host), port.number u.path = ((u.path:sub(1,1) == "/" and "" ) or "/" ) .. u.path -- ensuring leading slash end + if ( not(u.path) ) then + u.path = "/" + end if ( u.query ) then u.path = ("%s?%s"):format( u.path, u.query ) end diff --git a/nselib/sslcert.lua b/nselib/sslcert.lua index d37ab8dcb..9eb3884c5 100644 --- a/nselib/sslcert.lua +++ b/nselib/sslcert.lua @@ -200,6 +200,9 @@ function getCertificate(host, port) end end local cert = socket:get_ssl_certificate() + if ( cert == nil ) then + return false, "Unable to get cert" + end host.registry["ssl-cert"] = host.registry["ssl-cert"] or {} host.registry["ssl-cert"][port.number] = host.registry["ssl-cert"][port.number] or {}