]> git.ipfire.org Git - thirdparty/bind9.git/commit
Fix an interfacemgr use-after-free error in zoneconf.c:isself()
authorAram Sargsyan <aram@isc.org>
Wed, 24 May 2023 14:26:04 +0000 (14:26 +0000)
committerAram Sargsyan <aram@isc.org>
Wed, 24 May 2023 14:26:04 +0000 (14:26 +0000)
commit64d69e4adc1f4c4dfb51f6880eb7b48d76d38792
tree4bbdbcfd31c3e20e287292bca6bef29646d2abc4
parent5f62932bb1af461e8fa5f9ffd9ed034019f16fe5
Fix an interfacemgr use-after-free error in zoneconf.c:isself()

The 'named_g_server->interfacemgr' pointer is saved in the zone
structure using dns_zone_setisself(), as a void* argument to be
passed to the isself() callback, so there is no attach/detach,
and when shutting down, the interface manager can be destroyed
by the shutdown_server(), running in exclusive mode, and causing
isself() to crash when trying to use the pointer.

Instead of keeping the interface manager pointer in the zone
structure, just check and use the 'named_g_server->interfacemgr'
itself, as it was implemented originally in the
3aca8e5bf3740bbcc3bb13dde242d7cc369abb27 commit. Later, in the
8eb88aafee951859264e36c315b1289cd8c2088b commit, the code was
changed to pass the interface manager pointer using the additional
void* argument, but the commit message doesn't mention if there
was any practical reason for that.

Additionally, don't pass the interfacemgr pointer to the
ns_interfacemgr_getaclenv() function before it is checked
against NULL.
bin/named/zoneconf.c