summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrej Gessel <Andrej.Gessel@janztec.com>2018-04-06 18:18:33 +0200
committerStefan Metzmacher <metze@samba.org>2018-08-14 17:42:11 +0200
commit31a001f2e2f8eadd3e652984e30b7c0cccfe4f1c (patch)
treede3521a8fc833516b813fff048b43a0835458c4d /lib
parent3e89172fc75d5b2f5d5ec2b7b7efdf3be5c174eb (diff)
downloadsamba-31a001f2e2f8eadd3e652984e30b7c0cccfe4f1c.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 fb606124fb4..185da3d91d5 100644
--- a/lib/ldb/ldb_tdb/ldb_index.c
+++ b/lib/ldb/ldb_tdb/ldb_index.c
@@ -1597,6 +1597,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) {