summaryrefslogtreecommitdiff
path: root/lib/dns/rdata.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dns/rdata.c')
-rw-r--r--lib/dns/rdata.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/dns/rdata.c b/lib/dns/rdata.c
index c282b033cfc8f..063b1f6609758 100644
--- a/lib/dns/rdata.c
+++ b/lib/dns/rdata.c
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdata.c,v 1.209 2011-01-13 04:59:25 tbox Exp $ */
+/* $Id: rdata.c,v 1.209.8.2 2011-03-11 06:47:05 marka Exp $ */
/*! \file */
@@ -708,6 +708,7 @@ rdata_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
if (use_default) {
strlcpy(buf, "\\# ", sizeof(buf));
result = str_totext(buf, target);
+ INSIST(result == ISC_R_SUCCESS);
dns_rdata_toregion(rdata, &sr);
INSIST(sr.length < 65536);
snprintf(buf, sizeof(buf), "%u", sr.length);
@@ -963,6 +964,9 @@ dns_rdatatype_format(dns_rdatatype_t rdtype,
isc_result_t result;
isc_buffer_t buf;
+ if (size == 0U)
+ return;
+
isc_buffer_init(&buf, array, size);
result = dns_rdatatype_totext(rdtype, &buf);
/*
@@ -974,10 +978,8 @@ dns_rdatatype_format(dns_rdatatype_t rdtype,
else
result = ISC_R_NOSPACE;
}
- if (result != ISC_R_SUCCESS) {
- snprintf(array, size, "<unknown>");
- array[size - 1] = '\0';
- }
+ if (result != ISC_R_SUCCESS)
+ strlcpy(array, "<unknown>", size);
}
/*