1
0
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:
david
2012-11-12 19:34:22 +00:00
parent 665e6b9e70
commit 0d3a8846b0

View File

@@ -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