mirror of
https://github.com/nmap/nmap.git
synced 2025-12-12 02:39:03 +00:00
Use sock:receive when neither the "lines" nor "bytes" option is given to
comm.exchange. Previously it was acting as if it got bytes=1, which could return as few as one bytes. sock:receive will read until timeout or EOF.
This commit is contained in:
@@ -52,11 +52,6 @@ local setup_connect = function(host, port, opts)
|
||||
return status, err
|
||||
end
|
||||
|
||||
-- If nothing is given, specify bytes=1 so NSE reads everything
|
||||
if not opts.lines and not opts.bytes then
|
||||
opts.bytes = 1
|
||||
end
|
||||
|
||||
return true, sock
|
||||
end
|
||||
|
||||
@@ -68,10 +63,15 @@ local read = function(sock, opts)
|
||||
return status, response
|
||||
end
|
||||
|
||||
if opts.bytes then
|
||||
status, response = sock:receive_bytes(opts.bytes)
|
||||
return status, response
|
||||
end
|
||||
|
||||
status, response = sock:receive()
|
||||
return status, response
|
||||
end
|
||||
|
||||
--- This function simply connects to the specified port number on the
|
||||
-- specified host and returns any data received.
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user