2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

Also print out valid printable utf8

This commit is contained in:
Mark Andrews
2020-05-11 16:26:13 +10:00
parent b144ae1bb0
commit 1c8f9d06e2

View File

@@ -4091,11 +4091,16 @@ dns_message_pseudosectiontotext(dns_message_t *msg, dns_pseudosection_t section,
if (optlen != 0) {
int i;
bool utf8ok = false;
ADD_STRING(target, " ");
optdata = isc_buffer_current(&optbuf);
if (optcode != DNS_OPT_EDE) {
if (optcode == DNS_OPT_EDE) {
utf8ok = isc_utf8_valid(optdata,
optlen);
}
if (!utf8ok) {
for (i = 0; i < optlen; i++) {
const char *sep;
switch (optcode) {
@@ -4162,6 +4167,9 @@ dns_message_pseudosectiontotext(dns_message_t *msg, dns_pseudosection_t section,
if (isprint(optdata[i])) {
isc_buffer_putmem(
target, &optdata[i], 1);
} else if (utf8ok && optdata[i] > 127) {
isc_buffer_putmem(
target, &optdata[i], 1);
} else {
isc_buffer_putstr(target, ".");
}