2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

4748. [cleanup] Sprintf to snprintf coversions. [RT #46132]

This commit is contained in:
Mark Andrews
2017-10-03 14:54:19 +11:00
parent 7cb14b610e
commit a009d03a1a
55 changed files with 179 additions and 146 deletions

View File

@@ -1790,8 +1790,8 @@ dns64_reverse(dns_view_t *view, isc_mem_t *mctx, isc_netaddr_t *na,
unsigned int prefixlen, const char *server,
const char *contact)
{
char *cp;
char reverse[48+sizeof("ip6.arpa.")];
char reverse[48+sizeof("ip6.arpa.")] = { 0 };
char buf[sizeof("x.x.")];
const char *dns64_dbtype[4] = { "_dns64", "dns64", ".", "." };
const char *sep = ": view ";
const char *viewname = view->name;
@@ -1814,15 +1814,13 @@ dns64_reverse(dns_view_t *view, isc_mem_t *mctx, isc_netaddr_t *na,
/*
* Construct the reverse name of the zone.
*/
cp = reverse;
s6 = na->type.in6.s6_addr;
while (prefixlen > 0) {
prefixlen -= 8;
sprintf(cp, "%x.%x.", s6[prefixlen/8] & 0xf,
(s6[prefixlen/8] >> 4) & 0xf);
cp += 4;
snprintf(buf, sizeof(buf), "%x.%x.", s6[prefixlen/8] & 0xf,
(s6[prefixlen/8] >> 4) & 0xf);
strlcat(reverse, buf, sizeof(reverse));
}
strlcat(reverse, "ip6.arpa.", sizeof(reverse));
/*