summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrej Gessel <Andrej.Gessel@janztec.com>2018-04-06 18:18:33 +0200
committerKarolin Seeger <kseeger@samba.org>2018-08-11 08:16:03 +0200
commit95c95a4a99a41e175784319259f646f3deffcfe9 (patch)
treece6fb14232a95a0b3ac628851098404d596cb874 /lib
parenta5245e464d710ecb41c759d04ae1c762fbd8d2e9 (diff)
downloadsamba-95c95a4a99a41e175784319259f646f3deffcfe9.tar.gz
CVE-2018-1140 Add NULL check for ldb_dn_get_casefold() in ltdb_index_dn_attr()
Signed-off-by: Andrej Gessel <Andrej.Gessel@janztec.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> BUG: https://bugzilla.samba.org/show_bug.cgi?id=13374
Diffstat (limited to 'lib')
-rw-r--r--lib/ldb/ldb_tdb/ldb_index.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/ldb/ldb_tdb/ldb_index.c b/lib/ldb/ldb_tdb/ldb_index.c
index 40baeea5c2b..682469396ce 100644
--- a/lib/ldb/ldb_tdb/ldb_index.c
+++ b/lib/ldb/ldb_tdb/ldb_index.c
@@ -1405,6 +1405,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);
if (!key) {