From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4129 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: inet_pton problem Date: Sat, 19 Oct 2013 22:22:18 -0400 Message-ID: <20131020022218.GG20515@brightrain.aerifal.cx> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1382235749 21959 80.91.229.3 (20 Oct 2013 02:22:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2013 02:22:29 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4133-gllmg-musl=m.gmane.org@lists.openwall.com Sun Oct 20 04:22:33 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1VXif3-00050W-4o for gllmg-musl@plane.gmane.org; Sun, 20 Oct 2013 04:22:33 +0200 Original-Received: (qmail 21687 invoked by uid 550); 20 Oct 2013 02:22:31 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 21679 invoked from network); 20 Oct 2013 02:22:31 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:4129 Archived-At: On Sat, Oct 19, 2013 at 10:57:00PM +0200, Paul Schutte wrote: > Hi, > > I came across this and believe it is a bug. > > I have found that when you set str to an IPv4 addr of the from > "xxx.xxx.xxx.xxx' while the address family is AF_INET6, then instead of > returning a 0 to indicate an invalid IPv6 string, it is converted to > gibberish. >From what I can tell, it's not converted to gibberish; instead, it's wrongly returning an error (-1) instead of a result indicating an invalid input string (0). One could argue that it's a programming error not to check this, but inet_pton should not have any reason to return -1 if the first argument (af) is valid, so one could also argue that such checks would be extraneous bloat. > inet_pton(AF_INET6, "192.168.1.1', &sa) should return 0 if I understand the > specification correctly. Agreed. Rich