Module Name:    src
Committed By:   christos
Date:           Tue Oct  9 22:55:40 UTC 2012

Modified Files:
        src/external/bsd/bind/dist: CHANGES version
        src/external/bsd/bind/dist/bin/named: query.c

Log Message:
Apply P4:

3383.  [security]      A certain combination of records in the RBT could
                       cause named to hang while populating the additional
                       section of a response. [RT #31090]


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/bind/dist/CHANGES
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/bind/dist/version
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/bind/dist/bin/named/query.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/bind/dist/CHANGES
diff -u src/external/bsd/bind/dist/CHANGES:1.6 src/external/bsd/bind/dist/CHANGES:1.7
--- src/external/bsd/bind/dist/CHANGES:1.6	Thu Sep 13 01:32:07 2012
+++ src/external/bsd/bind/dist/CHANGES	Tue Oct  9 18:55:39 2012
@@ -1,3 +1,9 @@
+	--- 9.9.1-P4 released ---
+
+3383.	[security]	A certain combination of records in the RBT could
+                        cause named to hang while populating the additional
+                        section of a response. [RT #31090]
+
 	--- 9.9.1-P3 released ---
 
 3364.	[security]	Named could die on specially crafted record.

Index: src/external/bsd/bind/dist/version
diff -u src/external/bsd/bind/dist/version:1.3 src/external/bsd/bind/dist/version:1.4
--- src/external/bsd/bind/dist/version:1.3	Thu Sep 13 01:32:07 2012
+++ src/external/bsd/bind/dist/version	Tue Oct  9 18:55:39 2012
@@ -7,4 +7,4 @@ MAJORVER=9
 MINORVER=9
 PATCHVER=1
 RELEASETYPE=-P
-RELEASEVER=3
+RELEASEVER=4

Index: src/external/bsd/bind/dist/bin/named/query.c
diff -u src/external/bsd/bind/dist/bin/named/query.c:1.8 src/external/bsd/bind/dist/bin/named/query.c:1.9
--- src/external/bsd/bind/dist/bin/named/query.c:1.8	Mon Jun  4 20:39:03 2012
+++ src/external/bsd/bind/dist/bin/named/query.c	Tue Oct  9 18:55:40 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: query.c,v 1.8 2012/06/05 00:39:03 christos Exp $	*/
+/*	$NetBSD: query.c,v 1.9 2012/10/09 22:55:40 christos Exp $	*/
 
 /*
  * Copyright (C) 2004-2012  Internet Systems Consortium, Inc. ("ISC")
@@ -1121,13 +1121,6 @@ query_isduplicate(ns_client_t *client, d
 		mname = NULL;
 	}
 
-	/*
-	 * If the dns_name_t we're looking up is already in the message,
-	 * we don't want to trigger the caller's name replacement logic.
-	 */
-	if (name == mname)
-		mname = NULL;
-
 	if (mnamep != NULL)
 		*mnamep = mname;
 
@@ -1332,6 +1325,7 @@ query_addadditional(void *arg, dns_name_
 	if (dns_rdataset_isassociated(rdataset) &&
 	    !query_isduplicate(client, fname, type, &mname)) {
 		if (mname != NULL) {
+			INSIST(mname != fname);
 			query_releasename(client, &fname);
 			fname = mname;
 		} else
@@ -1401,11 +1395,13 @@ query_addadditional(void *arg, dns_name_
 #endif
 			if (!query_isduplicate(client, fname,
 					       dns_rdatatype_a, &mname)) {
-				if (mname != NULL) {
-					query_releasename(client, &fname);
-					fname = mname;
-				} else
-					need_addname = ISC_TRUE;
+				if (mname != fname) {
+					if (mname != NULL) {
+						query_releasename(client, &fname);
+						fname = mname;
+					} else
+						need_addname = ISC_TRUE;
+				}
 				ISC_LIST_APPEND(fname->list, rdataset, link);
 				added_something = ISC_TRUE;
 				if (sigrdataset != NULL &&
@@ -1458,11 +1454,13 @@ query_addadditional(void *arg, dns_name_
 #endif
 			if (!query_isduplicate(client, fname,
 					       dns_rdatatype_aaaa, &mname)) {
-				if (mname != NULL) {
-					query_releasename(client, &fname);
-					fname = mname;
-				} else
-					need_addname = ISC_TRUE;
+				if (mname != fname) {
+					if (mname != NULL) {
+						query_releasename(client, &fname);
+						fname = mname;
+					} else
+						need_addname = ISC_TRUE;
+				}
 				ISC_LIST_APPEND(fname->list, rdataset, link);
 				added_something = ISC_TRUE;
 				if (sigrdataset != NULL &&
@@ -1993,22 +1991,24 @@ query_addadditional2(void *arg, dns_name
 		    crdataset->type == dns_rdatatype_aaaa) {
 			if (!query_isduplicate(client, fname, crdataset->type,
 					       &mname)) {
-				if (mname != NULL) {
-					/*
-					 * A different type of this name is
-					 * already stored in the additional
-					 * section.  We'll reuse the name.
-					 * Note that this should happen at most
-					 * once.  Otherwise, fname->link could
-					 * leak below.
-					 */
-					INSIST(mname0 == NULL);
-
-					query_releasename(client, &fname);
-					fname = mname;
-					mname0 = mname;
-				} else
-					need_addname = ISC_TRUE;
+				if (mname != fname) {
+					if (mname != NULL) {
+						/*
+						 * A different type of this name is
+						 * already stored in the additional
+						 * section.  We'll reuse the name.
+						 * Note that this should happen at most
+						 * once.  Otherwise, fname->link could
+						 * leak below.
+						 */
+						INSIST(mname0 == NULL);
+
+						query_releasename(client, &fname);
+						fname = mname;
+						mname0 = mname;
+					} else
+						need_addname = ISC_TRUE;
+				}
 				ISC_LIST_UNLINK(cfname.list, crdataset, link);
 				ISC_LIST_APPEND(fname->list, crdataset, link);
 				added_something = ISC_TRUE;

Reply via email to