Date: Wed, 29 Aug 2001 06:30:02 -0700 (PDT) From: David Malone <dwmalone@maths.tcd.ie> To: freebsd-bugs@FreeBSD.org Subject: Re: misc/30186: getaddrinfo does not handle incorrect servname Message-ID: <200108291330.f7TDU2v11730@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR misc/30186; it has been noted by GNATS. From: David Malone <dwmalone@maths.tcd.ie> To: John Morrow <jmorrow@inktomi.com> Cc: freebsd-gnats-submit@FreeBSD.org Subject: Re: misc/30186: getaddrinfo does not handle incorrect servname Date: Wed, 29 Aug 2001 14:23:38 +0100 On Wed, Aug 29, 2001 at 03:28:56AM -0700, John Morrow wrote: > >Description: > If I call getaddrinfo("127.0.0.1", "80", &hints, &res) as a non-root > user and then bind using the returned socket address structure my > program is bound to the wrong address and port. I would have expected > a correctly filled out socket address structure and then a EACCESS > from bind(2). Bind(2) is returning -1 and setting errno to EACCESS, but you didn't check the return value from bind, so your program didn't notice. Then, when you call listen(2), an ephemeral port is assigned to your program so that it can listen. > Also putting negative or high port numbers into this program > never causes getaddrinfo to return an error. I guess that's another issue - I assume it's taking them mod 65536. David. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200108291330.f7TDU2v11730>