mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-03 16:15:27 +00:00
3154. [bug] Attempting to print an empty rdataset could trigger
an assert. [RT #25452]
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -1,3 +1,6 @@
|
||||
3154. [bug] Attempting to print an empty rdataset could trigger
|
||||
an assert. [RT #25452]
|
||||
|
||||
3153. [func] Extend request-ixfr to zone level and remove the
|
||||
side effect of forcing an AXFR. [RT #25156]
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: masterdump.c,v 1.108 2011/06/08 22:13:50 each Exp $ */
|
||||
/* $Id: masterdump.c,v 1.109 2011/09/07 19:11:13 each Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -419,12 +419,11 @@ rdataset_totext(dns_rdataset_t *rdataset,
|
||||
|
||||
rdataset->attributes |= DNS_RDATASETATTR_LOADORDER;
|
||||
result = dns_rdataset_first(rdataset);
|
||||
REQUIRE(result == ISC_R_SUCCESS);
|
||||
|
||||
current_ttl = ctx->current_ttl;
|
||||
current_ttl_valid = ctx->current_ttl_valid;
|
||||
|
||||
do {
|
||||
while (result == ISC_R_SUCCESS) {
|
||||
column = 0;
|
||||
|
||||
/*
|
||||
@@ -550,7 +549,7 @@ rdataset_totext(dns_rdataset_t *rdataset,
|
||||
|
||||
first = ISC_FALSE;
|
||||
result = dns_rdataset_next(rdataset);
|
||||
} while (result == ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
if (result != ISC_R_NOMORE)
|
||||
return (result);
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: master_test.c,v 1.5 2011/09/02 21:15:37 each Exp $ */
|
||||
/* $Id: master_test.c,v 1.6 2011/09/07 19:11:14 each Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -27,8 +27,10 @@
|
||||
#include <dns/cache.h>
|
||||
#include <dns/callbacks.h>
|
||||
#include <dns/master.h>
|
||||
#include <dns/masterdump.h>
|
||||
#include <dns/name.h>
|
||||
#include <dns/rdata.h>
|
||||
#include <dns/rdatalist.h>
|
||||
#include <dns/rdataset.h>
|
||||
|
||||
#include "dnstest.h"
|
||||
@@ -326,6 +328,50 @@ ATF_TC_BODY(master_leadingzero, tc) {
|
||||
dns_test_end();
|
||||
}
|
||||
|
||||
ATF_TC(master_totext);
|
||||
ATF_TC_HEAD(master_totext, tc) {
|
||||
atf_tc_set_md_var(tc, "descr", "masterfile totext tests");
|
||||
}
|
||||
ATF_TC_BODY(master_totext, tc) {
|
||||
isc_result_t result;
|
||||
dns_rdataset_t rdataset;
|
||||
dns_rdatalist_t rdatalist;
|
||||
isc_buffer_t target;
|
||||
unsigned char buf[BIGBUFLEN];
|
||||
|
||||
UNUSED(tc);
|
||||
|
||||
result = dns_test_begin(NULL, ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
/* First, test with an empty rdataset */
|
||||
rdatalist.rdclass = dns_rdataclass_in;
|
||||
rdatalist.type = dns_rdatatype_none;
|
||||
rdatalist.covers = dns_rdatatype_none;
|
||||
rdatalist.ttl = 0;
|
||||
ISC_LIST_INIT(rdatalist.rdata);
|
||||
ISC_LINK_INIT(&rdatalist, link);
|
||||
|
||||
dns_rdataset_init(&rdataset);
|
||||
result = dns_rdatalist_tordataset(&rdatalist, &rdataset);
|
||||
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
isc_buffer_init(&target, buf, BIGBUFLEN);
|
||||
result = dns_master_rdatasettotext(dns_rootname,
|
||||
&rdataset, &dns_master_style_debug,
|
||||
&target);
|
||||
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
|
||||
ATF_CHECK_EQ(isc_buffer_usedlength(&target), 0);
|
||||
|
||||
/*
|
||||
* XXX: We will also need to add tests for dumping various
|
||||
* rdata types, classes, etc, and comparing the results against
|
||||
* known-good output.
|
||||
*/
|
||||
|
||||
dns_test_end();
|
||||
}
|
||||
|
||||
/*
|
||||
* Main
|
||||
*/
|
||||
@@ -341,6 +387,7 @@ ATF_TP_ADD_TCS(tp) {
|
||||
ATF_TP_ADD_TC(tp, master_includefail);
|
||||
ATF_TP_ADD_TC(tp, master_blanklines);
|
||||
ATF_TP_ADD_TC(tp, master_leadingzero);
|
||||
ATF_TP_ADD_TC(tp, master_totext);
|
||||
|
||||
return (atf_no_error());
|
||||
}
|
||||
|
Reference in New Issue
Block a user