From 03a4ab7a72d9a43c25068ad7b666043398ec9f3c Mon Sep 17 00:00:00 2001 From: Jun-ichiro itojun Hagino Date: Sat, 29 Jun 2002 12:25:43 +0000 Subject: correct port range check. from deraadt. sync w/kame. bind-bugs have already notified. --- lib/libc/net/getaddrinfo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/libc') 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: -- cgit v1.2.3