mirror of
https://github.com/nmap/nmap.git
synced 2025-12-29 02:49:01 +00:00
Set target port number based on target af, not o.af.
o.af is AF_UNSPEC at this point in the common case that neither -4 nor -6 was given. The code was falling through to the "else" IPv6 case. I think we were getting luck with this because the port number happens to be in the same place in sockaddr_in and sockaddr_in6.
This commit is contained in:
@@ -639,7 +639,7 @@ int main(int argc, char *argv[])
|
||||
o.portno = (unsigned short) long_port;
|
||||
}
|
||||
|
||||
if (o.af == AF_INET)
|
||||
if (targetss.storage.ss_family == AF_INET)
|
||||
targetss.in.sin_port = htons(o.portno);
|
||||
#ifdef HAVE_IPV6
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user