Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 19 Oct 2013 22:22:18 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: inet_pton problem

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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.