continue;
}
} else if (optcode == DNS_OPT_EDE) {
- ADD_STRING(target, "; EDE:");
+ ADD_STRING(target, "; EDE");
if (optlen >= 2U) {
uint16_t ede;
ede = isc_buffer_getuint16(&optbuf);
/* Malformed */
optdata = isc_buffer_current(&optbuf);
snprintf(buf, sizeof(buf),
- " %02x (\"%c\")\n", optdata[0],
+ ": %02x (\"%c\")\n",
+ optdata[0],
isprint(optdata[0])
? optdata[0]
: '.');
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) {
if (isc_buffer_availablelength(target) < optlen)
return (ISC_R_NOSPACE);
for (i = 0; i < optlen; i++) {
- if (isprint(optdata[i]))
- isc_buffer_putmem(target,
- &optdata[i],
- 1);
- else
+ 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, ".");
+ }
}
if (optcode != DNS_OPT_EDE) {
ADD_STRING(target, "\")");