From: Mark Andrews Date: Fri, 14 Sep 2018 05:49:51 +0000 (+1000) Subject: only emit a single space between mac length and the orginal id if the mac length... X-Git-Tag: v9.13.4~140^2 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=ac1c3aaa27e9027ab40a2a2d20ce8b7d8b0e1623;p=thirdparty%2Fbind9.git only emit a single space between mac length and the orginal id if the mac length is zero --- diff --git a/lib/dns/rdata/any_255/tsig_250.c b/lib/dns/rdata/any_255/tsig_250.c index fa8d924c845..5ed242d4682 100644 --- a/lib/dns/rdata/any_255/tsig_250.c +++ b/lib/dns/rdata/any_255/tsig_250.c @@ -187,22 +187,26 @@ totext_any_tsig(ARGS_TOTEXT) { /* * Signature. */ - REQUIRE(n <= sr.length); - sigr = sr; - sigr.length = n; - if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) - RETERR(str_totext(" (", target)); - RETERR(str_totext(tctx->linebreak, target)); - if (tctx->width == 0) /* No splitting */ - RETERR(isc_base64_totext(&sigr, 60, "", target)); - else - RETERR(isc_base64_totext(&sigr, tctx->width - 2, - tctx->linebreak, target)); - if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) - RETERR(str_totext(" ) ", target)); - else + if (n != 0U) { + REQUIRE(n <= sr.length); + sigr = sr; + sigr.length = n; + if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) + RETERR(str_totext(" (", target)); + RETERR(str_totext(tctx->linebreak, target)); + if (tctx->width == 0) /* No splitting */ + RETERR(isc_base64_totext(&sigr, 60, "", target)); + else + RETERR(isc_base64_totext(&sigr, tctx->width - 2, + tctx->linebreak, target)); + if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) + RETERR(str_totext(" ) ", target)); + else + RETERR(str_totext(" ", target)); + isc_region_consume(&sr, n); + } else { RETERR(str_totext(" ", target)); - isc_region_consume(&sr, n); + } /* * Original ID.