dns_difftuple_t *t;
isc_buffer_t buffer;
void *mem = NULL;
- unsigned int size;
+ size_t size;
isc_result_t result;
isc_region_t used;
size += t->rdata.length;
}
+ if (size >= DNS_JOURNAL_SIZE_MAX) {
+ return (ISC_R_RANGE);
+ }
+
mem = isc_mem_get(j->mctx, size);
if (mem == NULL)
return (ISC_R_NOMEMORY);
}
}
+ /*
+ * We currently don't support huge journal entries.
+ */
+ unsigned long long total = j->x.pos[1].offset - j->x.pos[0].offset;
+ if (total >= DNS_JOURNAL_SIZE_MAX) {
+ isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR,
+ "transaction too big to be stored in journal :"
+ "%llub (max is %llub)", total,
+ (unsigned long long)DNS_JOURNAL_SIZE_MAX);
+ return (ISC_R_UNEXPECTED);
+ }
+
/*
* Some old journal entries may become non-addressable
* when we increment the current serial number. Purge them
journal_xhdr_t xhdr;
journal_rrhdr_t rrhdr;
- INSIST(j->offset <= j->it.epos.offset);
+ if (j->offset > j->it.epos.offset) {
+ isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR,
+ "%s: journal corrupt: possible integer overflow",
+ j->filename);
+ return (ISC_R_UNEXPECTED);
+ }
if (j->offset == j->it.epos.offset)
return (ISC_R_NOMORE);
if (j->it.xpos == j->it.xsize) {
result = dns_db_diff(zone->mctx, db, ver, zone->db, NULL,
zone->journal);
+ if (result == ISC_R_RANGE) {
+ dns_zone_log(zone, ISC_LOG_ERROR,
+ "ixfr-from-differences: failed: "
+ "difference too big to be stored "
+ "in journal");
+ goto fail;
+ }
if (result != ISC_R_SUCCESS)
goto fail;
if (dump)