mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- Fix more undefined sanitizer issues, in respip copy_rrset null
dname, and in the client_info_compare routine for null memcmp.
This commit is contained in:
parent
57bbbfc0e6
commit
6f4818ebcb
3 changed files with 31 additions and 11 deletions
|
|
@ -3,6 +3,8 @@
|
|||
from snprintf.
|
||||
- Fix #170: Fix gcc undefined sanitizer signed integer overflow
|
||||
warning in signature expiry RFC1982 serial number arithmetic.
|
||||
- Fix more undefined sanitizer issues, in respip copy_rrset null
|
||||
dname, and in the client_info_compare routine for null memcmp.
|
||||
|
||||
26 February 2020: Wouter
|
||||
- iana portlist updated.
|
||||
|
|
|
|||
|
|
@ -502,10 +502,16 @@ copy_rrset(const struct ub_packed_rrset_key* key, struct regional* region)
|
|||
ck->entry.hash = key->entry.hash;
|
||||
ck->entry.key = ck;
|
||||
ck->rk = key->rk;
|
||||
ck->rk.dname = regional_alloc_init(region, key->rk.dname,
|
||||
key->rk.dname_len);
|
||||
if(!ck->rk.dname)
|
||||
return NULL;
|
||||
if(key->rk.dname) {
|
||||
ck->rk.dname = regional_alloc_init(region, key->rk.dname,
|
||||
key->rk.dname_len);
|
||||
if(!ck->rk.dname)
|
||||
return NULL;
|
||||
ck->rk.dname_len = key->rk.dname_len;
|
||||
} else {
|
||||
ck->rk.dname = NULL;
|
||||
ck->rk.dname_len = 0;
|
||||
}
|
||||
|
||||
if((unsigned)data->count >= 0xffff00U)
|
||||
return NULL; /* guard against integer overflow in dsize */
|
||||
|
|
|
|||
|
|
@ -159,16 +159,28 @@ client_info_compare(const struct respip_client_info* ci_a,
|
|||
return 1;
|
||||
if(ci_a->taglen != ci_b->taglen)
|
||||
return (ci_a->taglen < ci_b->taglen) ? -1 : 1;
|
||||
cmp = memcmp(ci_a->taglist, ci_b->taglist, ci_a->taglen);
|
||||
if(cmp != 0)
|
||||
return cmp;
|
||||
if(ci_a->taglist && !ci_b->taglist)
|
||||
return -1;
|
||||
if(!ci_a->taglist && ci_b->taglist)
|
||||
return 1;
|
||||
if(ci_a->taglist && ci_b->taglist) {
|
||||
cmp = memcmp(ci_a->taglist, ci_b->taglist, ci_a->taglen);
|
||||
if(cmp != 0)
|
||||
return cmp;
|
||||
}
|
||||
if(ci_a->tag_actions_size != ci_b->tag_actions_size)
|
||||
return (ci_a->tag_actions_size < ci_b->tag_actions_size) ?
|
||||
-1 : 1;
|
||||
cmp = memcmp(ci_a->tag_actions, ci_b->tag_actions,
|
||||
ci_a->tag_actions_size);
|
||||
if(cmp != 0)
|
||||
return cmp;
|
||||
if(ci_a->tag_actions && !ci_b->tag_actions)
|
||||
return -1;
|
||||
if(!ci_a->tag_actions && ci_b->tag_actions)
|
||||
return 1;
|
||||
if(ci_a->tag_actions && ci_b->tag_actions) {
|
||||
cmp = memcmp(ci_a->tag_actions, ci_b->tag_actions,
|
||||
ci_a->tag_actions_size);
|
||||
if(cmp != 0)
|
||||
return cmp;
|
||||
}
|
||||
if(ci_a->tag_datas != ci_b->tag_datas)
|
||||
return ci_a->tag_datas < ci_b->tag_datas ? -1 : 1;
|
||||
if(ci_a->view != ci_b->view)
|
||||
|
|
|
|||
Loading…
Reference in a new issue