aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Barton <dougb@FreeBSD.org>2012-09-20 03:38:28 +0000
committerDoug Barton <dougb@FreeBSD.org>2012-09-20 03:38:28 +0000
commitc8aac173de01c185458640b7dd5e559d5727d465 (patch)
treee0b5d63bc2bdd94facfed037bb4fca7399a722f8
parentc55bb3d31a5c057d53c2af6f908485d9720b0e85 (diff)
downloadsrc-c8aac173de01c185458640b7dd5e559d5727d465.tar.gz
src-c8aac173de01c185458640b7dd5e559d5727d465.zip
Vendor import of BIND 9.8.3-P3vendor/bind9/9.8.3-P3
Notes
Notes: svn path=/vendor/bind9/dist/; revision=240726 svn path=/vendor/bind9/9.8.3-P3/; revision=240727; tag=vendor/bind9/9.8.3-P3
-rw-r--r--CHANGES5
-rw-r--r--lib/dns/include/dns/rdata.h11
-rw-r--r--lib/dns/master.c2
-rw-r--r--lib/dns/rdata.c28
-rw-r--r--lib/dns/rdataslab.c1
-rw-r--r--version2
6 files changed, 41 insertions, 8 deletions
diff --git a/CHANGES b/CHANGES
index 1ddc078008d6..0cc247a3b251 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+ --- 9.8.3-P3 released ---
+
+3364. [security] Named could die on specially crafted record.
+ [RT #30416]
+
--- 9.8.3-P2 released ---
3346. [security] Bad-cache data could be used before it was
diff --git a/lib/dns/include/dns/rdata.h b/lib/dns/include/dns/rdata.h
index e3183c0553f1..c3e7db61bdbf 100644
--- a/lib/dns/include/dns/rdata.h
+++ b/lib/dns/include/dns/rdata.h
@@ -147,6 +147,17 @@ struct dns_rdata {
(((rdata)->flags & ~(DNS_RDATA_UPDATE|DNS_RDATA_OFFLINE)) == 0)
/*
+ * The maximum length of a RDATA that can be sent on the wire.
+ * Max packet size (65535) less header (12), less name (1), type (2),
+ * class (2), ttl(4), length (2).
+ *
+ * None of the defined types that support name compression can exceed
+ * this and all new types are to be sent uncompressed.
+ */
+
+#define DNS_RDATA_MAXLENGTH 65512U
+
+/*
* Flags affecting rdata formatting style. Flags 0xFFFF0000
* are used by masterfile-level formatting and defined elsewhere.
* See additional comments at dns_rdata_tofmttext().
diff --git a/lib/dns/master.c b/lib/dns/master.c
index ae07e55a4b31..7f6cf581bf95 100644
--- a/lib/dns/master.c
+++ b/lib/dns/master.c
@@ -75,7 +75,7 @@
/*%
* max message size - header - root - type - class - ttl - rdlen
*/
-#define MINTSIZ (65535 - 12 - 1 - 2 - 2 - 4 - 2)
+#define MINTSIZ DNS_RDATA_MAXLENGTH
/*%
* Size for tokens in the presentation format,
* The largest tokens are the base64 blocks in KEY and CERT records,
diff --git a/lib/dns/rdata.c b/lib/dns/rdata.c
index f6807d1a4003..d200f1b56683 100644
--- a/lib/dns/rdata.c
+++ b/lib/dns/rdata.c
@@ -429,6 +429,7 @@ dns_rdata_fromwire(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
isc_buffer_t st;
isc_boolean_t use_default = ISC_FALSE;
isc_uint32_t activelength;
+ size_t length;
REQUIRE(dctx != NULL);
if (rdata != NULL) {
@@ -459,6 +460,14 @@ dns_rdata_fromwire(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
}
/*
+ * Reject any rdata that expands out to more than DNS_RDATA_MAXLENGTH
+ * as we cannot transmit it.
+ */
+ length = isc_buffer_usedlength(target) - isc_buffer_usedlength(&st);
+ if (result == ISC_R_SUCCESS && length > DNS_RDATA_MAXLENGTH)
+ result = DNS_R_FORMERR;
+
+ /*
* We should have consumed all of our buffer.
*/
if (result == ISC_R_SUCCESS && !buffer_empty(source))
@@ -466,8 +475,7 @@ dns_rdata_fromwire(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
if (rdata != NULL && result == ISC_R_SUCCESS) {
region.base = isc_buffer_used(&st);
- region.length = isc_buffer_usedlength(target) -
- isc_buffer_usedlength(&st);
+ region.length = length;
dns_rdata_fromregion(rdata, rdclass, type, &region);
}
@@ -602,6 +610,7 @@ dns_rdata_fromtext(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
unsigned long line;
void (*callback)(dns_rdatacallbacks_t *, const char *, ...);
isc_result_t tresult;
+ size_t length;
REQUIRE(origin == NULL || dns_name_isabsolute(origin) == ISC_TRUE);
if (rdata != NULL) {
@@ -673,10 +682,13 @@ dns_rdata_fromtext(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
}
} while (1);
+ length = isc_buffer_usedlength(target) - isc_buffer_usedlength(&st);
+ if (result == ISC_R_SUCCESS && length > DNS_RDATA_MAXLENGTH)
+ result = ISC_R_NOSPACE;
+
if (rdata != NULL && result == ISC_R_SUCCESS) {
region.base = isc_buffer_used(&st);
- region.length = isc_buffer_usedlength(target) -
- isc_buffer_usedlength(&st);
+ region.length = length;
dns_rdata_fromregion(rdata, rdclass, type, &region);
}
if (result != ISC_R_SUCCESS) {
@@ -804,6 +816,7 @@ dns_rdata_fromstruct(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
isc_buffer_t st;
isc_region_t region;
isc_boolean_t use_default = ISC_FALSE;
+ size_t length;
REQUIRE(source != NULL);
if (rdata != NULL) {
@@ -818,10 +831,13 @@ dns_rdata_fromstruct(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
if (use_default)
(void)NULL;
+ length = isc_buffer_usedlength(target) - isc_buffer_usedlength(&st);
+ if (result == ISC_R_SUCCESS && length > DNS_RDATA_MAXLENGTH)
+ result = ISC_R_NOSPACE;
+
if (rdata != NULL && result == ISC_R_SUCCESS) {
region.base = isc_buffer_used(&st);
- region.length = isc_buffer_usedlength(target) -
- isc_buffer_usedlength(&st);
+ region.length = length;
dns_rdata_fromregion(rdata, rdclass, type, &region);
}
if (result != ISC_R_SUCCESS)
diff --git a/lib/dns/rdataslab.c b/lib/dns/rdataslab.c
index 6fbfdd715c92..cb9ae5425ef9 100644
--- a/lib/dns/rdataslab.c
+++ b/lib/dns/rdataslab.c
@@ -305,6 +305,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx,
length = x[i].rdata.length;
if (rdataset->type == dns_rdatatype_rrsig)
length++;
+ INSIST(length <= 0xffff);
*rawbuf++ = (length & 0xff00) >> 8;
*rawbuf++ = (length & 0x00ff);
#if DNS_RDATASET_FIXED
diff --git a/version b/version
index 505a6c76c99a..9d821a2cabb2 100644
--- a/version
+++ b/version
@@ -7,4 +7,4 @@ MAJORVER=9
MINORVER=8
PATCHVER=3
RELEASETYPE=-P
-RELEASEVER=2
+RELEASEVER=3