--- a/lib/dns/rdata/generic/loc_29.c 2018-09-04 00:04:41.000000000 -0400 +++ b/lib/dns/rdata/generic/loc_291.c 2019-04-18 00:09:34.927000000 -0400 @@ -454,11 +454,12 @@ totext_loc(ARGS_TOTEXT) { isc_boolean_t east; isc_boolean_t below; isc_region_t sr; - char buf[sizeof("89 59 59.999 N 179 59 59.999 E " - "-42849672.95m 90000000m 90000000m 90000000m")]; char sbuf[sizeof("90000000m")]; char hbuf[sizeof("90000000m")]; char vbuf[sizeof("90000000m")]; + /* "89 59 59.999 N 179 59 59.999 E " */ + /* "-42849672.95m 90000000m 90000000m 90000000m"; */ + char buf[8*6 + 12*1 + 2*10 + sizeof(sbuf)+sizeof(hbuf)+sizeof(vbuf)]; unsigned char size, hp, vp; unsigned long poweroften[8] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000 }; @@ -550,7 +551,7 @@ totext_loc(ARGS_TOTEXT) { altitude -= 10000000; } - snprintf(buf, sizeof(buf), + snprintf(NULL, 0, "%d %d %d.%03d %s %d %d %d.%03d %s %s%lu.%02lum %s %s %s", d1, m1, s1, fs1, north ? "N" : "S", d2, m2, s2, fs2, east ? "E" : "W", --- a/lib/dns/rdata/in_1/dhcid_49.c 2018-09-04 00:04:41.000000000 -0400 +++ b/lib/dns/rdata/in_1/dhcid_491.c 2019-04-18 00:12:14.143000000 -0400 @@ -35,9 +35,8 @@ fromtext_in_dhcid(ARGS_FROMTEXT) { static inline isc_result_t totext_in_dhcid(ARGS_TOTEXT) { isc_region_t sr, sr2; - char buf[sizeof(" ; 64000 255 64000")]; - size_t n; - + /* " ; 64000 255 64000" */ + char buf[5 + 3*5 + 1]; REQUIRE(rdata->type == dns_rdatatype_dhcid); REQUIRE(rdata->rdclass == dns_rdataclass_in); REQUIRE(rdata->length != 0); @@ -55,10 +54,9 @@ totext_in_dhcid(ARGS_TOTEXT) { if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) { RETERR(str_totext(/* ( */ " )", target)); if (rdata->length > 2) { - n = snprintf(buf, sizeof(buf), " ; %u %u %u", + snprintf(NULL, 0, " ; %u %u %u", sr2.base[0] * 256U + sr2.base[1], sr2.base[2], rdata->length - 3U); - INSIST(n < sizeof(buf)); RETERR(str_totext(buf, target)); } }