mirror of
https://github.com/nmap/nmap.git
synced 2026-05-13 16:57:06 +00:00
Prevent script from crashing when running against ::1.
This case wasn't properly handled. Simply return nil. It could also return 127.0.0.1 or 127.0.0.0/8 instead of early exit though I doubt it makes that much sense for user.
This commit is contained in:
parent
b45f3e89f5
commit
1ebe659bd5
1 changed files with 5 additions and 3 deletions
|
|
@ -197,9 +197,11 @@ local function do_ipv6(addr)
|
|||
|
||||
output = stdnse.output_table()
|
||||
|
||||
if matches(addr, "0000:0000:0000:0000:0000:0000:XXXX:XXXX")
|
||||
and not matches(addr, "0000:0000:0000:0000:0000:0000:0000:0001") then
|
||||
-- RFC 4291 2.5.5.1. Specifically exclude ::1 for localhost.
|
||||
if matches(addr, "0000:0000:0000:0000:0000:0000:0000:0001") then
|
||||
-- ::1 is localhost. Not much to report.
|
||||
return nil
|
||||
elseif matches(addr, "0000:0000:0000:0000:0000:0000:XXXX:XXXX") then
|
||||
-- RFC 4291 2.5.5.1.
|
||||
local ipv4 = { addr[13], addr[14], addr[15], addr[16] }
|
||||
return {["IPv4-compatible"]= { ["IPv4 address"] = format_ipv4(ipv4) } }
|
||||
elseif matches(addr, "0000:0000:0000:0000:0000:ffff:XXXX:XXXX") then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue