From 804491723506377b42419c645d7f9d8314ce6dfe Mon Sep 17 00:00:00 2001 From: Andrej Gessel Date: Fri, 6 Apr 2018 18:18:33 +0200 Subject: [PATCH 2/2] [PATCH] Add NULL check for ldb_dn_get_casefold() in ltdb_index_dn_attr() Signed-off-by: Andrej Gessel --- lib/ldb/ldb_tdb/ldb_index.c | 9 +++++++++ selftest/knownfail.d/ldb.base | 1 - 2 files changed, 9 insertions(+), 1 deletion(-) delete mode 100644 selftest/knownfail.d/ldb.base diff --git a/lib/ldb/ldb_tdb/ldb_index.c b/lib/ldb/ldb_tdb/ldb_index.c index 59434f3..9697b8c 100644 --- a/lib/ldb/ldb_tdb/ldb_index.c +++ b/lib/ldb/ldb_tdb/ldb_index.c @@ -1582,6 +1582,15 @@ static int ltdb_index_dn_attr(struct ldb_module *module, /* work out the index key from the parent DN */ val.data = (uint8_t *)((uintptr_t)ldb_dn_get_casefold(dn)); + if (val.data == NULL) { + const char *dn_str = ldb_dn_get_linearized(dn); + ldb_asprintf_errstring(ldb_module_get_ctx(module), + __location__ + ": Failed to get casefold DN" + "from: %s", + dn_str); + return LDB_ERR_OPERATIONS_ERROR; + } val.length = strlen((char *)val.data); key = ltdb_index_key(ldb, ltdb, attr, &val, NULL, truncation); if (!key) { diff --git a/selftest/knownfail.d/ldb.base b/selftest/knownfail.d/ldb.base deleted file mode 100644 index 6018160..0000000 --- a/selftest/knownfail.d/ldb.base +++ /dev/null @@ -1 +0,0 @@ -^ldb.base \ No newline at end of file -- 2.7.4