mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Natanael Copa <ncopa@alpinelinux.org>
To: musl@lists.openwall.com
Cc: Natanael Copa <ncopa@alpinelinux.org>
Subject: [PATCH] fix handling of zero length domain names in dn_expand
Date: Wed, 13 Aug 2014 10:21:41 +0200	[thread overview]
Message-ID: <1407918101-3407-1-git-send-email-ncopa@alpinelinux.org> (raw)

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) {
-- 
2.0.4



             reply	other threads:[~2014-08-13  8:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-13  8:21 Natanael Copa [this message]
     [not found] ` <20140904095039.496f5810@ncopa-desktop.alpinelinux.org>
2014-09-04 17:07   ` Szabolcs Nagy
2014-09-04 18:11     ` Szabolcs Nagy
2014-09-04 20:20       ` Rich Felker
2014-09-04 22:15         ` Szabolcs Nagy
2014-09-04 22:41           ` Rich Felker
2014-09-04 20:22       ` Natanael Copa

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=1407918101-3407-1-git-send-email-ncopa@alpinelinux.org \
    --to=ncopa@alpinelinux.org \
    --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).