diff --git a/lib/dns/message.c b/lib/dns/message.c index 17e3e83e3a..9eaeb990f0 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -102,6 +102,13 @@ hexdump(const char *msg, const char *msg2, void *base, size_t len) { } else \ isc_buffer_putstr(b, s); \ } +#define PUT_YAMLSTR(target, namebuf, len, utfok) \ + { \ + result = put_yamlstr(target, namebuf, len, utfok); \ + if (result != ISC_R_SUCCESS) { \ + goto cleanup; \ + } \ + } #define VALID_NAMED_PSEUDOSECTION(s) \ (((s) > DNS_PSEUDOSECTION_ANY) && ((s) < DNS_PSEUDOSECTION_MAX)) #define VALID_PSEUDOSECTION(s) \ @@ -3500,11 +3507,8 @@ render_nameopt(isc_buffer_t *optbuf, bool yaml, isc_buffer_t *target) { dns_name_format(name, namebuf, sizeof(namebuf)); ADD_STRING(target, " \""); if (yaml) { - result = put_yamlstr(target, (unsigned char *)namebuf, - strlen(namebuf), false); - if (result != ISC_R_SUCCESS) { - goto cleanup; - } + PUT_YAMLSTR(target, (unsigned char *)namebuf, + strlen(namebuf), false); } else { ADD_STRING(target, namebuf); } @@ -3574,11 +3578,8 @@ render_zoneversion(dns_message_t *msg, isc_buffer_t *optbuf, ADD_STRING(target, "ZONE: "); if (yaml) { ADD_STRING(target, "\""); - put_yamlstr(target, (unsigned char *)namebuf, + PUT_YAMLSTR(target, (unsigned char *)namebuf, strlen(namebuf), false); - if (result != ISC_R_SUCCESS) { - goto cleanup; - } ADD_STRING(target, "\""); } else { ADD_STRING(target, namebuf); @@ -3610,7 +3611,7 @@ render_zoneversion(dns_message_t *msg, isc_buffer_t *optbuf, ADD_STRING(target, sep2); INDENT(style); ADD_STRING(target, "PVALUE: \""); - put_yamlstr(target, data, len, false); + PUT_YAMLSTR(target, data, len, false); ADD_STRING(target, "\""); } else { ADD_STRING(target, " (\""); @@ -4030,7 +4031,7 @@ dns_message_pseudosectiontoyaml(dns_message_t *msg, dns_pseudosection_t section, } else { ADD_STRING(target, "\""); } - put_yamlstr(target, optdata, optlen, utf8ok); + PUT_YAMLSTR(target, optdata, optlen, utf8ok); if (!extra_text) { ADD_STRING(target, "\")"); } else {