2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

3031. [bug] dns_rdataclass_format() handle a zero sized buffer.

[RT #22521]
This commit is contained in:
Mark Andrews 2011-02-21 06:50:42 +00:00
parent e01f55daa4
commit 6883a918f7
2 changed files with 9 additions and 5 deletions

View File

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

View File

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rcode.c,v 1.16 2010/12/23 04:07:58 marka Exp $ */
/* $Id: rcode.c,v 1.17 2011/02/21 06:50:42 marka Exp $ */
#include <config.h>
#include <ctype.h>
@ -494,6 +494,9 @@ dns_rdataclass_format(dns_rdataclass_t rdclass,
isc_result_t result;
isc_buffer_t buf;
if (size == 0U)
return;
isc_buffer_init(&buf, array, size);
result = dns_rdataclass_totext(rdclass, &buf);
/*
@ -505,8 +508,6 @@ dns_rdataclass_format(dns_rdataclass_t rdclass,
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);
}