]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Check before storing value.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 20 Mar 2015 15:58:55 +0000 (15:58 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 20 Mar 2015 15:58:55 +0000 (15:58 +0000)
git-svn-id: file:///svn/unbound/trunk@3373 be551aaa-1e26-0410-a405-d3ace91eadb9

daemon/cachedump.c

index 2780397e7f63d6205da3bea13191b5ca1e7d49ca..6df1127f5106e522e46bb7895f73f4c743f4fe91 100644 (file)
@@ -652,13 +652,13 @@ load_msg(SSL* ssl, sldns_buffer* buf, struct worker* worker)
        rep.ttl = (time_t)ttl;
        rep.prefetch_ttl = PREFETCH_TTL_CALC(rep.ttl);
        rep.security = (enum sec_status)security;
-       rep.an_numrrsets = (size_t)an;
-       rep.ns_numrrsets = (size_t)ns;
-       rep.ar_numrrsets = (size_t)ar;
        if(an > RR_COUNT_MAX || ns > RR_COUNT_MAX || ar > RR_COUNT_MAX) {
                log_warn("error too many rrsets");
                return 0; /* protect against integer overflow in alloc */
        }
+       rep.an_numrrsets = (size_t)an;
+       rep.ns_numrrsets = (size_t)ns;
+       rep.ar_numrrsets = (size_t)ar;
        rep.rrset_count = (size_t)an+(size_t)ns+(size_t)ar;
        rep.rrsets = (struct ub_packed_rrset_key**)regional_alloc_zero(
                region, sizeof(struct ub_packed_rrset_key*)*rep.rrset_count);