1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-27 00:29:03 +00:00

Fix a script crash when comm.opencon was called without opts

This commit is contained in:
dmiller
2014-09-24 20:31:44 +00:00
parent 23d4abd5e9
commit 278450ce94

View File

@@ -213,13 +213,14 @@ end
-- @return early_resp If opt recv_before is true, returns the value
-- of the first receive (before sending data)
function opencon(host, port, data, opts)
opts = opts or {}
local status, sd = setup_connect(host, port, opts)
if not status then
return nil, sd, nil
end
local response, early_resp;
if opts and opts.recv_before then status, early_resp = read(sd, opts) end
if opts.recv_before then status, early_resp = read(sd, opts) end
if data and #data > 0 then
sd:send(data)
status, response = sd:receive()