summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Schlyter <jakob@cvs.openbsd.org>2007-12-13 22:22:01 +0000
committerJakob Schlyter <jakob@cvs.openbsd.org>2007-12-13 22:22:01 +0000
commitbac0b3c081dedd188783e175c5c50ba5929b69f6 (patch)
tree50c22009a61543da67b2c0dda5b5569a11d08bce
parent6dd5f66e1e7ee93cdc0b2062b7acd6d2efe8bcc5 (diff)
more str fixes; from chl@
-rw-r--r--usr.sbin/bind/lib/dns/zone.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/bind/lib/dns/zone.c b/usr.sbin/bind/lib/dns/zone.c
index eddc9689d90..9e6dc435aa6 100644
--- a/usr.sbin/bind/lib/dns/zone.c
+++ b/usr.sbin/bind/lib/dns/zone.c
@@ -808,7 +808,7 @@ zone_freedbargs(dns_zone_t *zone) {
isc_result_t
dns_zone_getdbtype(dns_zone_t *zone, char ***argv, isc_mem_t *mctx) {
- size_t size = 0;
+ size_t size = 0, remaining_size, l;
unsigned int i;
isc_result_t result = ISC_R_SUCCESS;
void *mem;
@@ -826,10 +826,13 @@ dns_zone_getdbtype(dns_zone_t *zone, char ***argv, isc_mem_t *mctx) {
tmp = mem;
tmp2 = mem;
tmp2 += (zone->db_argc + 1) * sizeof(char *);
+ remaining_size = size - (zone->db_argc + 1) * sizeof(char *);
for (i = 0; i < zone->db_argc; i++) {
*tmp++ = tmp2;
- strcpy(tmp2, zone->db_argv[i]);
- tmp2 += strlen(tmp2) + 1;
+ strlcpy(tmp2, zone->db_argv[i], remaining_size);
+ l = strlen(tmp2) + 1;
+ tmp2 += l;
+ remaining_size -= l;
}
*tmp = NULL;
} else