[PATCH] dsdb: Fix CID 1363810: Null pointer dereferences

Volker Lendecke vl at samba.org
Tue Jul 12 16:33:00 UTC 2016


Hi!

Review appreciated!

If needed, I can provide just the isolated fix and the other aspects
of the patch in separate patches.

Thanks, Volker
-------------- next part --------------
>From e05d5fe3bad5f5ecadb27592be2098a99e37d431 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 12 Jul 2016 18:28:23 +0200
Subject: [PATCH] dsdb: Fix CID 1363810: Null pointer dereferences

The if-condition explicitly tests for new_schema==NULL, so this seems to be a
valid error case. The DEBUG statement would segfault in this case.

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source4/dsdb/repl/replicated_objects.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c
index 88ba598..6d39dba 100644
--- a/source4/dsdb/repl/replicated_objects.c
+++ b/source4/dsdb/repl/replicated_objects.c
@@ -891,9 +891,12 @@ WERROR dsdb_replicated_objects_commit(struct ldb_context *ldb,
 		 * unable to operate for other users from this
 		 * point... */
 		if (new_schema == NULL || new_schema == working_schema) {
-			DEBUG(0,("Failed to re-load schema after commit of transaction (working: %p/%llu, new: %p/%llu)\n",
-				 new_schema, (unsigned long long)new_schema->metadata_usn,
-				 working_schema, (unsigned long long)working_schema->metadata_usn));
+			DBG_ERR("Failed to re-load schema after commit of "
+				"transaction (working: %p/%"PRIu64", new: "
+				"%p/%"PRIu64")\n", new_schema,
+				new_schema != NULL ?
+				new_schema->metadata_usn : 0,
+				working_schema, working_schema->metadata_usn);
 			dsdb_reference_schema(ldb, cur_schema, false);
 			if (used_global_schema) {
 				dsdb_set_global_schema(ldb);
-- 
1.9.1



More information about the samba-technical mailing list