From b61143cc79cb5c3e23f403c4980f8a03ab7426c0 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Jul 31 2013 17:09:48 +0000 Subject: fix coverity 11895 - null deref - caused by fix to ticket 47392 reviewed by: nhosoi (Thanks!) --- diff --git a/ldap/servers/plugins/replication/repl5_plugins.c b/ldap/servers/plugins/replication/repl5_plugins.c index 4c048dc..9c97ea6 100644 --- a/ldap/servers/plugins/replication/repl5_plugins.c +++ b/ldap/servers/plugins/replication/repl5_plugins.c @@ -1202,9 +1202,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); @@ -1213,18 +1217,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)); } }