mirror of
https://gitlab.isc.org/isc-projects/bind9.git
synced 2025-12-05 18:57:04 -06:00
fixup! dns_name_totext() can now resize dynamic buffers
This commit is contained in:
@@ -977,13 +977,10 @@ dns_name_totext(const dns_name_t *name, unsigned int options,
|
||||
isc_result_t result;
|
||||
unsigned char *ndata = NULL;
|
||||
unsigned int nlen;
|
||||
unsigned char c;
|
||||
unsigned int count;
|
||||
unsigned int labels;
|
||||
bool saw_root = false;
|
||||
unsigned int oused;
|
||||
bool omit_final_dot = ((options & DNS_NAME_OMITFINALDOT) != 0);
|
||||
uint32_t value;
|
||||
bool first = true;
|
||||
|
||||
/*
|
||||
@@ -1025,8 +1022,8 @@ dns_name_totext(const dns_name_t *name, unsigned int options,
|
||||
}
|
||||
|
||||
while (labels > 0 && nlen > 0) {
|
||||
unsigned int count = *ndata++;
|
||||
labels--;
|
||||
count = *ndata++;
|
||||
nlen--;
|
||||
if (count == 0) {
|
||||
saw_root = true;
|
||||
@@ -1038,9 +1035,13 @@ dns_name_totext(const dns_name_t *name, unsigned int options,
|
||||
first = false;
|
||||
|
||||
if (count <= DNS_NAME_LABELLEN) {
|
||||
unsigned char c;
|
||||
|
||||
INSIST(nlen >= count);
|
||||
|
||||
while (count > 0) {
|
||||
uint32_t value;
|
||||
|
||||
c = *ndata;
|
||||
switch (c) {
|
||||
/* Special modifiers in zone files. */
|
||||
@@ -1101,6 +1102,11 @@ dns_name_totext(const dns_name_t *name, unsigned int options,
|
||||
isc_buffer_putuint8(target, '.');
|
||||
}
|
||||
|
||||
if (isc_buffer_availablelength(target) > 1) {
|
||||
uint8_t *p = isc_buffer_used(target);
|
||||
*p = 0;
|
||||
}
|
||||
|
||||
if (totext_filter_proc != NULL) {
|
||||
return (totext_filter_proc)(target, oused);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user