Commit f908bb8eaba5147b4460e0e573d65d77816b709c

Ian Douglas Scott 2017-06-23T10:10:29

Convert port with htons() in p_getaddrinfo() `sin_port` should be in network byte order.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/posix.c b/src/posix.c
index 94deb6a..fd9188a 100644
--- a/src/posix.c
+++ b/src/posix.c
@@ -40,7 +40,7 @@ int p_getaddrinfo(
 	if (ainfo->ai_servent)
 		ainfo->ai_port = ainfo->ai_servent->s_port;
 	else
-		ainfo->ai_port = atol(port);
+		ainfo->ai_port = htons(atol(port));
 
 	memcpy(&ainfo->ai_addr_in.sin_addr,
 			ainfo->ai_hostent->h_addr_list[0],