From eb08c1fc8f877bffeaf63acfbc97ae00a4370a15 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 21 Jul 2005 08:06:39 +0000 Subject: r8668: fixed a segv during upgrade of a very old ldb. Thanks to volker for finding this one too. Keep them coming! (This used to be commit 756796ad2ea86a9471d1b09e66b1a74c4523f6f4) --- source4/lib/ldb/ldb_tdb/ldb_index.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source4/lib/ldb/ldb_tdb/ldb_index.c') diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c index 1cfebe6864..2fb6c34227 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_index.c +++ b/source4/lib/ldb/ldb_tdb/ldb_index.c @@ -1001,6 +1001,11 @@ static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void * /* check if the DN key has changed, perhaps due to the case insensitivity of an element changing */ key2 = ltdb_key(module, msg->dn); + if (key2.dptr == NULL) { + /* probably a corrupt record ... darn */ + ldb_debug(module->ldb, LDB_DEBUG_ERROR, "Invalid DN in re_index: %s\n", msg->dn); + return 0; + } if (strcmp(key2.dptr, key.dptr) != 0) { tdb_delete(tdb, key); tdb_store(tdb, key2, data, 0); -- cgit