|
|
Message-ID: <20140904095039.496f5810@ncopa-desktop.alpinelinux.org>
Date: Thu, 4 Sep 2014 09:50:39 +0200
From: Natanael Copa <ncopa@...inelinux.org>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] fix handling of zero length domain names in
dn_expand
On Wed, 13 Aug 2014 10:21:41 +0200
Natanael Copa <ncopa@...inelinux.org> wrote:
> Copy a zero length string instead of returning error when trying to
> expand a zero lentgh domain name (null terminator).
>
> This fixes a regression introduced with 56b57f37a46dab432.
> ---
> This should issue with kamailio handling NAPTR records for enum.
>
> I have verified that this correcponds with how uclibc handles zero
> length domain names.
>
> I have also verified that none of the 2 places in musl that uses
> __dn_expand should break. (I have read the code but not actually run
> tested it)
>
> src/network/dn_expand.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/network/dn_expand.c b/src/network/dn_expand.c
> index 849df19..3264faf 100644
> --- a/src/network/dn_expand.c
> +++ b/src/network/dn_expand.c
> @@ -6,7 +6,7 @@ int __dn_expand(const unsigned char *base, const unsigned char *end, const unsig
> const unsigned char *p = src;
> char *dend = dest + (space > 254 ? 254 : space);
> int len = -1, i, j;
> - if (p==end || !*p) return -1;
> + if (p==end) return -1;
> /* detect reference loop using an iteration counter */
> for (i=0; i < end-base; i+=2) {
> if (*p & 0xc0) {
Rich pointed out to me on IRC that this will not write terminating '\0'
when domain name length is zero. I'll send new patch.
-nc
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.