]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Also print out valid printable utf8
authorMark Andrews <marka@isc.org>
Mon, 11 May 2020 06:26:13 +0000 (16:26 +1000)
committerMark Andrews <marka@isc.org>
Tue, 12 May 2020 12:01:54 +0000 (22:01 +1000)
lib/dns/message.c

index fe08420436e9f0f4eb04037faf59adf49c4a4726..a3b0ae4ea6b508d95987b872f8b582f2e63c5f90 100644 (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, ".");
                                        }