From 496b3bc1eced77b8a34f9a6c4ba86da58349c682 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Wed, 31 Jul 2013 10:49:18 -0600 Subject: [PATCH 68/99] fix coverity 11895 - null deref - caused by fix to ticket 47392 reviewed by: nhosoi (Thanks!) (cherry picked from commit b61143cc79cb5c3e23f403c4980f8a03ab7426c0) (cherry picked from commit 03a67b1432bbafe5eb7a82a8afd0832f220c229b) (cherry picked from commit 877fee5b6228faf471eefed9a073dff13074b224) (cherry picked from commit 89a98eb66264718e3d7431a4cda92afe08371a84) --- ldap/servers/plugins/replication/repl5_plugins.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ldap/servers/plugins/replication/repl5_plugins.c b/ldap/servers/plugins/replication/repl5_plugins.c index 7aa2e2c..afb0364 100644 --- a/ldap/servers/plugins/replication/repl5_plugins.c +++ b/ldap/servers/plugins/replication/repl5_plugins.c @@ -1117,9 +1117,13 @@ write_changelog_and_ruv (Slapi_PBlock *pb) just read from the changelog in either the supplier or consumer ruv */ if (0 == return_value) { - char csn_str[CSN_STRSIZE]; + char csn_str[CSN_STRSIZE] = {'\0'}; CSN *opcsn; int rc; + const char *dn = op_params ? REPL_GET_DN(&op_params->target_address) : "unknown"; + char *uniqueid = op_params ? op_params->target_address.uniqueid : "unknown"; + unsigned long optype = op_params ? op_params->operation_type : 0; + CSN *oppcsn = op_params ? op_params->csn : NULL; slapi_pblock_get( pb, SLAPI_OPERATION, &op ); opcsn = operation_get_csn(op); @@ -1128,18 +1132,14 @@ write_changelog_and_ruv (Slapi_PBlock *pb) slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "write_changelog_and_ruv: RUV already covers csn for " "%s (uniqid: %s, optype: %lu) csn %s\n", - REPL_GET_DN(&op_params->target_address), - op_params->target_address.uniqueid, - op_params->operation_type, - csn_as_string(op_params->csn, PR_FALSE, csn_str)); + dn, uniqueid, optype, + csn_as_string(oppcsn, PR_FALSE, csn_str)); } else if (rc != RUV_SUCCESS) { slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "write_changelog_and_ruv: failed to update RUV for " "%s (uniqid: %s, optype: %lu) to changelog csn %s\n", - REPL_GET_DN(&op_params->target_address), - op_params->target_address.uniqueid, - op_params->operation_type, - csn_as_string(op_params->csn, PR_FALSE, csn_str)); + dn, uniqueid, optype, + csn_as_string(oppcsn, PR_FALSE, csn_str)); } } -- 1.8.1.4