From 8f9664521724eefc39728c092d0bc6be527e1496 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 29 May 2002 00:27:53 +0000 Subject: [PATCH] 1208. [bug] Adjusted REQUIRE's in lib/dns/name.c to better reflect written requirements. --- CHANGES | 3 +++ lib/dns/name.c | 15 +++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index c9bdf311c9..875b39be08 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +1208. [bug] Adjusted REQUIRE's in lib/dns/name.c to better + reflect written requirements. + 1207. [bug] REQUIRE that DNS_DBADD_MERGE only be set when adding a rdataset to a zone db in the rbtdb implementation of addrdataset. diff --git a/lib/dns/name.c b/lib/dns/name.c index 1a2545ab6e..e489fa48d8 100644 --- a/lib/dns/name.c +++ b/lib/dns/name.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: name.c,v 1.134 2002/05/28 03:39:46 marka Exp $ */ +/* $Id: name.c,v 1.135 2002/05/29 00:27:53 marka Exp $ */ #include @@ -1152,7 +1152,7 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source, REQUIRE(VALID_NAME(name)); REQUIRE(ISC_BUFFER_VALID(source)); REQUIRE((target != NULL && ISC_BUFFER_VALID(target)) || - (target == NULL && name->buffer != NULL)); + (target == NULL && ISC_BUFFER_VALID(name->buffer))); if (target == NULL && name->buffer != NULL) { target = name->buffer; @@ -2075,7 +2075,8 @@ dns_name_downcase(dns_name_t *source, dns_name_t *name, isc_buffer_t *target) { ndata = source->ndata; } else { REQUIRE(BINDABLE(name)); - REQUIRE(target != NULL || name->buffer != NULL); + REQUIRE((target != NULL && ISC_BUFFER_VALID(target)) || + (target == NULL && ISC_BUFFER_VALID(name->buffer))); if (target == NULL) { target = name->buffer; isc_buffer_clear(name->buffer); @@ -2365,6 +2366,8 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, */ REQUIRE(VALID_NAME(name)); + REQUIRE((target != NULL && ISC_BUFFER_VALID(target)) || + (target == NULL && ISC_BUFFER_VALID(name->buffer))); if (target == NULL && name->buffer != NULL) { target = name->buffer; @@ -2563,6 +2566,7 @@ dns_name_towire(dns_name_t *name, dns_compress_t *cctx, isc_buffer_t *target) { REQUIRE(VALID_NAME(name)); REQUIRE(cctx != NULL); + REQUIRE(ISC_BUFFER_VALID(target)); /* * If 'name' doesn't have an offsets table, make a clone which @@ -2640,6 +2644,8 @@ dns_name_concatenate(dns_name_t *prefix, dns_name_t *suffix, dns_name_t *name, REQUIRE(prefix == NULL || VALID_NAME(prefix)); REQUIRE(suffix == NULL || VALID_NAME(suffix)); REQUIRE(name == NULL || VALID_NAME(name)); + REQUIRE((target != NULL && ISC_BUFFER_VALID(target)) || + (target == NULL && name != NULL && ISC_BUFFER_VALID(name->buffer))); if (prefix == NULL || prefix->labels == 0) copy_prefix = ISC_FALSE; if (suffix == NULL || suffix->labels == 0) @@ -2653,7 +2659,8 @@ dns_name_concatenate(dns_name_t *prefix, dns_name_t *suffix, dns_name_t *name, DNS_NAME_INIT(&tmp_name, odata); name = &tmp_name; } - if (target == NULL && name->buffer != NULL) { + if (target == NULL) { + INSIST(name->buffer != NULL); target = name->buffer; isc_buffer_clear(name->buffer); }