Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200426001522.rgwtcn66zquyrufq@wolfsden.cz>
Date: Sun, 26 Apr 2020 02:15:22 +0200
From: Wolf <wolf@...fsden.cz>
To: musl@...ts.openwall.com
Subject: Re: Proposal to match behaviour of gethostbyname to glibc

Hello,

On 2020-04-17 14:46:40 -0400, Rich Felker wrote:
> Actually now that I'm doing this I'm not sure it's correct. The
> existing code reports all matches from the hosts file, not just the
> first one. This patch will prevent getting both ipv4 and ipv6 results,
> or multiple results for the same address family, by stopping after the
> first one.

Well, I've completely missed that. Sorry.

> If you want the canonical name to come from the first result, rather
> than suppressing all but the first result, the code instead needs to
> be changed to remember that it already found one name and not copy any
> others.

I've attached patch v2 doing exactly that. Hopefully this time it's
correct.

W.

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

View attachment "patch" of type "text/plain" (979 bytes)

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

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.