summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-06-29 12:25:43 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-06-29 12:25:43 +0000
commit03a4ab7a72d9a43c25068ad7b666043398ec9f3c (patch)
tree9aa2412f54c61527ab3e6c29e7d981cb7eae141f /lib/libc
parent38af605f9557d2dd196867d441ce60b21bfa1c97 (diff)
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: