andykimpe / rpms / 389-ds-base

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