summaryrefslogtreecommitdiffstats
path: root/lib/dns/master.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dns/master.c')
-rw-r--r--lib/dns/master.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/dns/master.c b/lib/dns/master.c
index 1e9fead..ae07e55 100644
--- a/lib/dns/master.c
+++ b/lib/dns/master.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004-2009, 2011 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: master.c,v 1.178.346.2 2011-03-12 04:59:17 tbox Exp $ */
+/* $Id$ */
/*! \file */
@@ -2257,14 +2257,14 @@ load_raw(dns_loadctx_t *lctx) {
if (rdcount > rdata_size) {
dns_rdata_t *new_rdata = NULL;
- new_rdata = grow_rdata(rdata_size + RDSZ, rdata,
+ new_rdata = grow_rdata(rdcount + RDSZ, rdata,
rdata_size, &head,
&dummy, mctx);
if (new_rdata == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
}
- rdata_size += RDSZ;
+ rdata_size = rdcount + RDSZ;
rdata = new_rdata;
}
@@ -2687,6 +2687,7 @@ grow_rdatalist(int new_len, dns_rdatalist_t *old, int old_len,
}
while ((this = ISC_LIST_HEAD(save)) != NULL) {
ISC_LIST_UNLINK(save, this, link);
+ INSIST(rdlcount < new_len);
new[rdlcount] = *this;
ISC_LIST_APPEND(*current, &new[rdlcount], link);
rdlcount++;
@@ -2699,6 +2700,7 @@ grow_rdatalist(int new_len, dns_rdatalist_t *old, int old_len,
}
while ((this = ISC_LIST_HEAD(save)) != NULL) {
ISC_LIST_UNLINK(save, this, link);
+ INSIST(rdlcount < new_len);
new[rdlcount] = *this;
ISC_LIST_APPEND(*glue, &new[rdlcount], link);
rdlcount++;
@@ -2742,6 +2744,7 @@ grow_rdata(int new_len, dns_rdata_t *old, int old_len,
}
while ((rdata = ISC_LIST_HEAD(save)) != NULL) {
ISC_LIST_UNLINK(save, rdata, link);
+ INSIST(rdcount < new_len);
new[rdcount] = *rdata;
ISC_LIST_APPEND(this->rdata, &new[rdcount], link);
rdcount++;
@@ -2761,13 +2764,14 @@ grow_rdata(int new_len, dns_rdata_t *old, int old_len,
}
while ((rdata = ISC_LIST_HEAD(save)) != NULL) {
ISC_LIST_UNLINK(save, rdata, link);
+ INSIST(rdcount < new_len);
new[rdcount] = *rdata;
ISC_LIST_APPEND(this->rdata, &new[rdcount], link);
rdcount++;
}
this = ISC_LIST_NEXT(this, link);
}
- INSIST(rdcount == old_len);
+ INSIST(rdcount == old_len || rdcount == 0);
if (old != NULL)
isc_mem_put(mctx, old, old_len * sizeof(*old));
return (new);
OpenPOWER on IntegriCloud