static unsigned char removed;
struct xrdata *x = NULL;
unsigned char *rawbuf = NULL;
- unsigned int buflen;
+ uint32_t buflen;
isc_result_t result;
unsigned int nitems;
unsigned int nalloc;
if (rdataset->type == dns_rdatatype_rrsig) {
buflen++;
}
+ if (buflen - reservelen - 2 > DNS_RDATA_MAXLENGTH) {
+ result = ISC_R_NOSPACE;
+ goto free_rdatas;
+ }
}
}
if (rdataset->type == dns_rdatatype_rrsig) {
buflen++;
}
+ if (buflen - reservelen - 2 > DNS_RDATA_MAXLENGTH) {
+ result = ISC_R_NOSPACE;
+ goto free_rdatas;
+ }
/*
* Ensure that singleton types are actually singletons.
unsigned char **tslabp) {
unsigned char *ocurrent = NULL, *ostart = NULL, *ncurrent = NULL;
unsigned char *tstart = NULL, *tcurrent = NULL, *data = NULL;
- unsigned int ocount, ncount, count, olength, tlength, tcount, length;
+ unsigned int ocount, ncount, count, olength, tcount, length;
+ uint32_t tlength;
dns_rdata_t ordata = DNS_RDATA_INIT;
dns_rdata_t nrdata = DNS_RDATA_INIT;
bool added_something = false;
if (type == dns_rdatatype_rrsig) {
tlength++;
}
+ if (tlength - reservelen - 2 > DNS_RDATA_MAXLENGTH) {
+ return ISC_R_NOSPACE;
+ }
tcount++;
nncount++;
added_something = true;
unsigned int flags, unsigned char **tslabp) {
unsigned char *mcurrent = NULL, *sstart = NULL, *scurrent = NULL;
unsigned char *tstart = NULL, *tcurrent = NULL;
- unsigned int mcount, scount, rcount, count, tlength, tcount, i;
+ unsigned int mcount, scount, rcount, count, tcount, i;
+ uint32_t tlength;
dns_rdata_t srdata = DNS_RDATA_INIT;
dns_rdata_t mrdata = DNS_RDATA_INIT;
#if DNS_RDATASET_FIXED
* This rdata isn't in the sslab, and thus isn't
* being subtracted.
*/
- tlength += (unsigned int)(mcurrent - mrdatabegin);
+ tlength += (uint32_t)(mcurrent - mrdatabegin);
+ if (tlength - reservelen - 2 > DNS_RDATA_MAXLENGTH) {
+ return ISC_R_NOSPACE;
+ }
tcount++;
} else {
rcount++;
* cache size doesn't reach the "max".
*/
while (i-- > 0) {
- overmempurge_addrdataset(db, now, i, 50054, 65535, false);
+ overmempurge_addrdataset(db, now, i, 50054,
+ DNS_RDATA_MAXLENGTH - 8, false);
if (verbose) {
print_message("# inuse: %zd max: %zd\n",
isc_mem_inuse(mctx2), maxcache);