summaryrefslogtreecommitdiff
path: root/respip/respip.c
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2019-12-28 05:27:06 +0000
committerCy Schubert <cy@FreeBSD.org>2019-12-28 05:27:06 +0000
commite2fe726866d062155f6b1aae749375475ef19191 (patch)
treefe6b00611d5c987d2c12c32063891ae19295ffeb /respip/respip.c
parent366b94c4a9552acfb560d3234aea0955ebc1eb8e (diff)
Diffstat (limited to 'respip/respip.c')
-rw-r--r--respip/respip.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/respip/respip.c b/respip/respip.c
index d61877b556cde..632a9df64756f 100644
--- a/respip/respip.c
+++ b/respip/respip.c
@@ -361,6 +361,7 @@ respip_set_apply_cfg(struct respip_set* set, char* const* tagname, int num_tags,
free(pd);
pd = np;
}
+ addr_tree_init_parents(&set->ip_tree);
return 1;
}
@@ -478,10 +479,16 @@ copy_rrset(const struct ub_packed_rrset_key* key, struct regional* region)
if(!ck->rk.dname)
return NULL;
+ if((unsigned)data->count >= 0xffff00U)
+ return NULL; /* guard against integer overflow in dsize */
dsize = sizeof(struct packed_rrset_data) + data->count *
(sizeof(size_t)+sizeof(uint8_t*)+sizeof(time_t));
- for(i=0; i<data->count; i++)
+ for(i=0; i<data->count; i++) {
+ if((unsigned)dsize >= 0x0fffffffU ||
+ (unsigned)data->rr_len[i] >= 0x0fffffffU)
+ return NULL; /* guard against integer overflow */
dsize += data->rr_len[i];
+ }
d = regional_alloc(region, dsize);
if(!d)
return NULL;
@@ -1181,5 +1188,5 @@ respip_inform_print(struct respip_addr_info* respip_addr, uint8_t* qname,
respip, sizeof(respip));
snprintf(txt, sizeof(txt), "%s/%d inform %s@%u", respip,
respip_addr->net, srcip, port);
- log_nametypeclass(0, txt, qname, qtype, qclass);
+ log_nametypeclass(NO_VERBOSE, txt, qname, qtype, qclass);
}