3030. [bug] dns_rdatatype_format() handle a zero sized buffer.

[RT #22521]
This commit is contained in:
Mark Andrews 2011-02-21 06:43:23 +00:00
parent 6efe8f6471
commit a06fa348e7
2 changed files with 9 additions and 5 deletions

View file

@ -1,3 +1,6 @@
3030. [bug] dns_rdatatype_format() handle a zero sized buffer.
[RT #22521]
3029. [bug] isc_netaddr_format() handle a zero sized buffer.
[RT #22521]

View file

@ -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.1 2011/02/21 06:43:23 marka Exp $ */
/*! \file */
@ -963,6 +963,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 +977,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);
}
/*