diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2003-05-08 22:34:47 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2003-05-08 22:34:47 +0000 |
commit | 17fda6262ea4af5b0c453ce710b52aa09f0e7ec7 (patch) | |
tree | c8ab724fbcc2e0171eb5c0e7be8caa77fbf0d544 /usr.sbin/bind/lib/dns | |
parent | 6f06a03a07d2361a33a9a6e7c69570f547bbe4f5 (diff) |
replace strcpy with strlcpy and some strdup.
ok rohee@ tdeval@ dhartmei@
requested by deraadt@
Diffstat (limited to 'usr.sbin/bind/lib/dns')
-rw-r--r-- | usr.sbin/bind/lib/dns/byaddr.c | 4 | ||||
-rw-r--r-- | usr.sbin/bind/lib/dns/master.c | 2 | ||||
-rw-r--r-- | usr.sbin/bind/lib/dns/name.c | 4 | ||||
-rw-r--r-- | usr.sbin/bind/lib/dns/tsig.c | 2 | ||||
-rw-r--r-- | usr.sbin/bind/lib/dns/zone.c | 4 |
5 files changed, 8 insertions, 8 deletions
diff --git a/usr.sbin/bind/lib/dns/byaddr.c b/usr.sbin/bind/lib/dns/byaddr.c index 97b93061aab..b173f489a43 100644 --- a/usr.sbin/bind/lib/dns/byaddr.c +++ b/usr.sbin/bind/lib/dns/byaddr.c @@ -100,7 +100,7 @@ dns_byaddr_createptrname(isc_netaddr_t *address, isc_boolean_t nibble, *cp++ = hex_digits[(bytes[i] >> 4) & 0x0f]; *cp++ = '.'; } - strcpy(cp, "ip6.int."); + strlcpy(cp, "ip6.int.", textname + sizeof(textname) - cp); } else { cp = textname; *cp++ = '\\'; @@ -112,7 +112,7 @@ dns_byaddr_createptrname(isc_netaddr_t *address, isc_boolean_t nibble, *cp++ = hex_digits[(bytes[i+1] >> 4) & 0x0f]; *cp++ = hex_digits[bytes[i+1] & 0x0f]; } - strcpy(cp, "].ip6.arpa."); + strlcpy(cp, "].ip6.arpa.", textname + sizeof(textname) - cp); } } else return (ISC_R_NOTIMPLEMENTED); diff --git a/usr.sbin/bind/lib/dns/master.c b/usr.sbin/bind/lib/dns/master.c index 2eb54686cc1..4e084bfe55b 100644 --- a/usr.sbin/bind/lib/dns/master.c +++ b/usr.sbin/bind/lib/dns/master.c @@ -530,7 +530,7 @@ genname(char *name, int it, char *buffer, size_t length) { isc_textregion_consume(&r, 1); continue; } - strcpy(fmt, "%d"); + strlcpy(fmt, "%d", sizeof(fmt)); /* Get format specifier. */ if (*name == '{' ) { n = sscanf(name, "{%d,%u,%1[doxX]}", diff --git a/usr.sbin/bind/lib/dns/name.c b/usr.sbin/bind/lib/dns/name.c index 73b3aaf3fc8..08c25ff2bb9 100644 --- a/usr.sbin/bind/lib/dns/name.c +++ b/usr.sbin/bind/lib/dns/name.c @@ -1808,7 +1808,7 @@ dns_name_totext(dns_name_t *name, isc_boolean_t omit_final_dot, if (count == 0) count = 256; nlen--; - len = sprintf(num, "%u", count); /* XXX */ + len = snprintf(num, sizeof(num), "%u", count); INSIST(len <= 4); bytes = count / 8; if (count % 8 != 0) @@ -1961,7 +1961,7 @@ dns_name_tofilenametext(dns_name_t *name, isc_boolean_t omit_final_dot, if (count == 0) count = 256; nlen--; - len = sprintf(num, "%u", count); /* XXX */ + len = snprintf(num, sizeof(num), "%u", count); INSIST(len <= 4); bytes = count / 8; if (count % 8 != 0) diff --git a/usr.sbin/bind/lib/dns/tsig.c b/usr.sbin/bind/lib/dns/tsig.c index fd526054358..ecc9012bfd6 100644 --- a/usr.sbin/bind/lib/dns/tsig.c +++ b/usr.sbin/bind/lib/dns/tsig.c @@ -114,7 +114,7 @@ tsig_log(dns_tsigkey_t *key, int level, const char *fmt, ...) { if (key != NULL) dns_name_format(&key->name, namestr, sizeof(namestr)); else - strcpy(namestr, "<null>"); + strlcpy(namestr, "<null>", sizeof(namestr)); va_start(ap, fmt); vsnprintf(message, sizeof(message), fmt, ap); va_end(ap); diff --git a/usr.sbin/bind/lib/dns/zone.c b/usr.sbin/bind/lib/dns/zone.c index 7b4ad73274f..ee3793dbe8e 100644 --- a/usr.sbin/bind/lib/dns/zone.c +++ b/usr.sbin/bind/lib/dns/zone.c @@ -826,8 +826,8 @@ default_journal(dns_zone_t *zone) { journal = isc_mem_allocate(zone->mctx, len); if (journal == NULL) return (ISC_R_NOMEMORY); - strcpy(journal, zone->masterfile); - strcat(journal, ".jnl"); + strlcpy(journal, zone->masterfile, len); + strlcat(journal, ".jnl", len); } else { journal = NULL; } |