From a0784e7a39cb564477e0ba683232e7edbcd144dc Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 4 Sep 2019 11:27:16 +1000 Subject: [PATCH 1/2] address NULL pointer dereferences (cherry picked from commit 2de94dd4c4ee170b071dd9c61cb10f3aedaa4485) --- .../dlz/modules/mysqldyn/dlz_mysqldyn_mod.c | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/contrib/dlz/modules/mysqldyn/dlz_mysqldyn_mod.c b/contrib/dlz/modules/mysqldyn/dlz_mysqldyn_mod.c index 13f99f68f6..9b126fda80 100644 --- a/contrib/dlz/modules/mysqldyn/dlz_mysqldyn_mod.c +++ b/contrib/dlz/modules/mysqldyn/dlz_mysqldyn_mod.c @@ -1304,9 +1304,21 @@ dlz_newversion(const char *zone, void *dbdata, void **versionp) { * Create new transaction */ newtx = (mysql_transaction_t *) - malloc(sizeof(mysql_transaction_t)); + calloc(1, sizeof(mysql_transaction_t)); + if (newtx == NULL) { + result = ISC_R_NOMEMORY; + goto cleanup; + } newtx->zone = strdup(zone); + if (newtx->zone == NULL) { + result = ISC_R_NOMEMORY; + goto cleanup; + } newtx->zone_id = strdup(zone_id); + if (newtx->zone_id == NULL) { + result = ISC_R_NOMEMORY; + goto cleanup; + } newtx->dbi = get_dbi(state); newtx->next = NULL; @@ -1336,9 +1348,15 @@ dlz_newversion(const char *zone, void *dbdata, void **versionp) { *versionp = (void *) newtx; } else { dlz_mutex_unlock(&state->tx_mutex); - free(newtx->zone); - free(newtx->zone_id); - free(newtx); + if (newtx != NULL) { + if (newtx->zone != NULL) { + free(newtx->zone); + } + if (newtx->zone != NULL) { + free(newtx->zone_id); + } + free(newtx); + } } return (result); From 8ccfd14a5231dd43b331e604973b07b39c4807d1 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 4 Sep 2019 11:31:28 +1000 Subject: [PATCH 2/2] add CHANGES (cherry picked from commit 8b65ac91287121c5bca5feeb8ec48ddd38be3c16) --- CHANGES | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES b/CHANGES index 1eadd10ef2..70e4570cb0 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +5286. [contrib] Address potential NULL pointer dereferences in + dlz_mysqldyn_mod.c. [GL #1207] + 5285. [port] win32: implement "-T maxudpXXX". [GL #837] 5282. [bug] Fixed a bug in searching for possible wildcard matches