From: Andreas Gustafsson Date: Mon, 27 Aug 2001 21:31:29 +0000 (+0000) Subject: eliminated arbitrary limit on formatted rdata size in 'host' [RT #1557] X-Git-Tag: v9.2.2rc1~9 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=187bf10eb566d407d54e66b42b468c6c33f2591c;p=thirdparty%2Fbind9.git eliminated arbitrary limit on formatted rdata size in 'host' [RT #1557] --- diff --git a/bin/dig/host.c b/bin/dig/host.c index 809ca97d0d8..a2a1a330bd9 100644 --- a/bin/dig/host.c +++ b/bin/dig/host.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: host.c,v 1.75 2001/08/01 16:18:56 bwelling Exp $ */ +/* $Id: host.c,v 1.76 2001/08/27 21:31:29 gson Exp $ */ #include #include @@ -260,11 +260,18 @@ say_message(dns_name_t *name, const char *msg, dns_rdata_t *rdata, char namestr[DNS_NAME_FORMATSIZE]; isc_region_t r; isc_result_t result; + unsigned int bufsize = BUFSIZ; - result = isc_buffer_allocate(mctx, &b, OUTPUTBUF); - check_result(result, "isc_buffer_allocate"); dns_name_format(name, namestr, sizeof(namestr)); + retry: + result = isc_buffer_allocate(mctx, &b, bufsize); + check_result(result, "isc_buffer_allocate"); result = dns_rdata_totext(rdata, NULL, b); + if (result == ISC_R_NOSPACE) { + isc_buffer_free(&b); + bufsize *= 2; + goto retry; + } check_result(result, "dns_rdata_totext"); isc_buffer_usedregion(b, &r); if (query->lookup->identify_previous_line) {