- Fix #1154: segfault when reading config with duplicate zones.

git-svn-id: file:///svn/unbound/trunk@3922 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2016-11-04 08:16:55 +00:00
parent fa81710d16
commit 68e4ef21db
2 changed files with 6 additions and 1 deletions

View file

@ -2,6 +2,7 @@
- configure detects ssl security level API function in the autoconf - configure detects ssl security level API function in the autoconf
manner. Every function on its own, so that other libraries (eg. manner. Every function on its own, so that other libraries (eg.
LibreSSL) can develop their API without hindrance. LibreSSL) can develop their API without hindrance.
- Fix #1154: segfault when reading config with duplicate zones.
3 November 2016: Ralph 3 November 2016: Ralph
- Set OpenSSL security level to 0 when using aNULL ciphers. - Set OpenSSL security level to 0 when using aNULL ciphers.

View file

@ -186,13 +186,17 @@ lz_enter_zone_dname(struct local_zones* zones, uint8_t* nm, size_t len,
lock_rw_wrlock(&zones->lock); lock_rw_wrlock(&zones->lock);
lock_rw_wrlock(&z->lock); lock_rw_wrlock(&z->lock);
if(!rbtree_insert(&zones->ztree, &z->node)) { if(!rbtree_insert(&zones->ztree, &z->node)) {
struct local_zone* oldz;
log_warn("duplicate local-zone"); log_warn("duplicate local-zone");
lock_rw_unlock(&z->lock); lock_rw_unlock(&z->lock);
local_zone_delete(z); /* save zone name locally before deallocation,
* otherwise, nm is gone if we zone_delete now. */
oldz = z;
/* find the correct zone, so not an error for duplicate */ /* find the correct zone, so not an error for duplicate */
z = local_zones_find(zones, nm, len, labs, c); z = local_zones_find(zones, nm, len, labs, c);
lock_rw_wrlock(&z->lock); lock_rw_wrlock(&z->lock);
lock_rw_unlock(&zones->lock); lock_rw_unlock(&zones->lock);
local_zone_delete(oldz);
return z; return z;
} }
lock_rw_unlock(&zones->lock); lock_rw_unlock(&zones->lock);