From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5818 Path: news.gmane.org!not-for-mail From: Natanael Copa Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH] fix handling of zero length domain names in dn_expand Date: Wed, 13 Aug 2014 10:21:41 +0200 Message-ID: <1407918101-3407-1-git-send-email-ncopa@alpinelinux.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1407918130 25816 80.91.229.3 (13 Aug 2014 08:22:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 Aug 2014 08:22:10 +0000 (UTC) Cc: Natanael Copa To: musl@lists.openwall.com Original-X-From: musl-return-5824-gllmg-musl=m.gmane.org@lists.openwall.com Wed Aug 13 10:22:03 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1XHTop-00034W-BJ for gllmg-musl@plane.gmane.org; Wed, 13 Aug 2014 10:22:03 +0200 Original-Received: (qmail 16208 invoked by uid 550); 13 Aug 2014 08:22:02 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 16199 invoked from network); 13 Aug 2014 08:22:02 -0000 X-Mailer: git-send-email 2.0.4 Xref: news.gmane.org gmane.linux.lib.musl.general:5818 Archived-At: 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