Hi,

When parsing uncompressed DNS names the end pointer only must be updated when encountering a compressed label, or after parsing all uncompressed labels. Otherwise parse_rr() will interpret the second uncompressed label as resource record header instead of the bits behind the name terminating NUL byte.

The attached patch addresses that issue.

Thank you,
Mathias
--
Join us at Qt Developer Days 2014 - October 6 - 8 at BCC, Berlin

Mathias Hasselmann | mathias.hasselm...@kdab.com | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel. Germany +49-30-521325470, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions

From ce2bede8c2de445e99262bb66b9effedbf186ced Mon Sep 17 00:00:00 2001
From: Mathias Hasselmann <mathias.hasselm...@kdab.com>
Date: Wed, 6 Aug 2014 21:47:37 +0200
Subject: [PATCH] Properly parse uncompressed DNS names

When parsing uncompressed DNS names the end pointer only must be updated when
encountering a compressed label, or after parsing all uncompressed labels.
Otherwise parse_rr() will interpret the second uncompressed label as resource
record header instead of the bits behind the name terminating NUL byte.
---
 src/dnsproxy.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/dnsproxy.c b/src/dnsproxy.c
index 7232b98..2de8bdc 100644
--- a/src/dnsproxy.c
+++ b/src/dnsproxy.c
@@ -880,14 +880,14 @@ static int get_name(int counter,
 
 			p += label_len + 1;
 
-			if (!*end)
-				*end = p;
-
 			if (p >= max)
 				return -ENOBUFS;
 		}
 	}
 
+	if (!*end)
+		*end = p + 1;
+
 	return 0;
 }
 
-- 
1.9.1


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Reply via email to