From 0d3a8846b023bcf5277a4fa1027c3645a3c43dae Mon Sep 17 00:00:00 2001 From: david Date: Mon, 12 Nov 2012 19:34:22 +0000 Subject: [PATCH] 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. --- ncat/ncat_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ncat/ncat_main.c b/ncat/ncat_main.c index bd55248da..b99f81dac 100644 --- a/ncat/ncat_main.c +++ b/ncat/ncat_main.c @@ -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