summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authoritojun <itojun@openbsd.org>2002-06-29 12:25:42 +0000
committeritojun <itojun@openbsd.org>2002-06-29 12:25:42 +0000
commit6d3403940f53b7b5a4f230bdc41cb23fa76e2880 (patch)
treebd7aeccbe678c8a3907791e43464e4c0b98e8785 /lib/libc
parentscrew the MLINKS (diff)
downloadwireguard-openbsd-6d3403940f53b7b5a4f230bdc41cb23fa76e2880.tar.xz
wireguard-openbsd-6d3403940f53b7b5a4f230bdc41cb23fa76e2880.zip
correct port range check. from deraadt. sync w/kame. bind-bugs have already notified.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/net/getaddrinfo.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c
index 9e28e7a2e74..0d945d1aba4 100644
--- a/lib/libc/net/getaddrinfo.c
+++ b/lib/libc/net/getaddrinfo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getaddrinfo.c,v 1.35 2002/06/27 09:55:49 itojun Exp $ */
+/* $OpenBSD: getaddrinfo.c,v 1.36 2002/06/29 12:25:42 itojun Exp $ */
/* $KAME: getaddrinfo.c,v 1.31 2000/08/31 17:36:43 itojun Exp $ */
/*
@@ -888,9 +888,10 @@ get_port(ai, servname, matchonly)
if (str_isnumber(servname)) {
if (!allownumeric)
return EAI_SERVICE;
- port = htons(atoi(servname));
+ port = atoi(servname);
if (port < 0 || port > 65535)
return EAI_SERVICE;
+ port = htons(port);
} else {
switch (ai->ai_socktype) {
case SOCK_DGRAM: