From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: inet_pton problem
Date: Sat, 19 Oct 2013 22:22:18 -0400 [thread overview]
Message-ID: <20131020022218.GG20515@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAKHv7pg9FNXdnjzPc5DabC7-cuOvSS4g9=XgbbPTT_9xS8DJiQ@mail.gmail.com>
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
next prev parent reply other threads:[~2013-10-20 2:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-19 20:57 Paul Schutte
2013-10-20 2:22 ` Rich Felker [this message]
2013-10-20 9:50 ` Paul Schutte
2013-10-20 12:26 ` Paul Schutte
2013-10-20 15:30 ` Paul Schutte
2013-10-20 16:45 ` Paul Schutte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131020022218.GG20515@brightrain.aerifal.cx \
--to=dalias@aerifal.cx \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).