r13289: Check the tree is not NULL
authorSimo Sorce <idra@samba.org>
Wed, 1 Feb 2006 20:48:05 +0000 (20:48 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:51:43 +0000 (13:51 -0500)
Thanks to Aaron J. Seigo <aseigo@kde.org> for spotting this

source/lib/ldb/ldb_tdb/ldb_search.c
source/lib/ldb/tools/ldbsearch.c

index ebbc1a39749ee79426af50b3e51c9a1869ea9556..e43125d588351c0ddf8be03752b0d02c6a048025 100644 (file)
@@ -473,6 +473,10 @@ int ltdb_search_bytree(struct ldb_module *module, const struct ldb_dn *base,
                return -1;
        }
 
+       if (tree == NULL) {
+               return -1;
+       }
+
        *res = NULL;
 
        ret = ltdb_search_indexed(module, base, scope, tree, attrs, res);
index 08a8b7f179052809571633b9e58d78fb1781566a..f96c14f5ec1d13b0112329dba2521bdfdc3b9f82 100644 (file)
@@ -74,6 +74,7 @@ static int do_search(struct ldb_context *ldb,
        req.op.search.base = basedn;
        req.op.search.scope = options->scope;
        req.op.search.tree = ldb_parse_tree(ldb, expression);
+       if (req.op.search.tree == NULL) return -1;
        req.op.search.attrs = attrs;
        req.op.search.res = NULL;
        req.controls = parse_controls(ldb, options->controls);