]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix possible NULL dereference in cd->dlz_destroy()
authorOndřej Surý <ondrej@isc.org>
Tue, 27 Oct 2020 13:18:43 +0000 (14:18 +0100)
committerMichał Kępień <michal@isc.org>
Wed, 28 Oct 2020 14:48:58 +0000 (15:48 +0100)
If the call to cd->dlz_create() in dlopen_dlz_create() fails, cd->dbdata
may be NULL when dlopen_dlz_destroy() gets called in the cleanup path
and passing NULL to the cd->dlz_destroy() callback may cause a NULL
dereference.  Ensure that does not happen by checking whether cd->dbdata
is non-NULL before calling the cd->dlz_destroy() callback.

bin/named/unix/dlz_dlopen_driver.c

index df119849701381e6419f178e8438aac5b0cc0b8c..e88ea6fc52e973dbeea6b18918616ead94549ff1 100644 (file)
@@ -339,7 +339,7 @@ dlopen_dlz_destroy(void *driverarg, void *dbdata) {
 
        UNUSED(driverarg);
 
-       if (cd->dlz_destroy) {
+       if (cd->dlz_destroy && cd->dbdata) {
                MAYBE_LOCK(cd);
                cd->dlz_destroy(cd->dbdata);
                MAYBE_UNLOCK(cd);