Index | Thread | Search

From:
Florian Obser <florian@openbsd.org>
Subject:
Re: The empty string is not a valid host name
To:
tech@openbsd.org
Date:
Sun, 21 Jun 2026 19:58:53 +0200

Download raw body.

Thread
Disregard,

deraadt@ pointed out glibc has this in their test harness and treats
this as ok.

https://codebrowser.dev/glibc/glibc/resolv/tst-res_hnok.c.html

I'm worried about an empty string ending up in h_aliases returned by
gethostbyname(3) when we are talking to a lying nameserver.

I'll come back with a diff for asr itself.

On 2026-06-21 19:27 +02, Florian Obser <florian@openbsd.org> wrote:
> On 2026-04-11 10:42 +02, Florian Obser <florian@openbsd.org> wrote:
>> I've spotted this while working on something else.
>>
>> OK?
>>
>
> Going through diffs that didn't make release. OK?
>
> diff --git lib/libc/net/res_comp.c lib/libc/net/res_comp.c
> index ce9f92ae771..43d50f93c2b 100644
> --- lib/libc/net/res_comp.c
> +++ lib/libc/net/res_comp.c
> @@ -348,6 +348,9 @@ __res_hnok(const char *dn)
>  {
>  	int pch = PERIOD, ch = *dn++;
>  
> +	if (ch == '\0')
> +		return (0);
> +
>  	while (ch != '\0') {
>  		int nch = *dn++;
>  
>
>
> -- 
>
> In my defence, I have been left unsupervised.
>

-- 
In my defence, I have been left unsupervised.