summaryrefslogtreecommitdiff
path: root/lib/ldb/common/ldb_parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ldb/common/ldb_parse.c')
-rw-r--r--lib/ldb/common/ldb_parse.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/ldb/common/ldb_parse.c b/lib/ldb/common/ldb_parse.c
index b4eabf8375..8c6c2d993e 100644
--- a/lib/ldb/common/ldb_parse.c
+++ b/lib/ldb/common/ldb_parse.c
@@ -534,8 +534,18 @@ static struct ldb_parse_tree *ldb_parse_filterlist(TALLOC_CTX *mem_ctx, const ch
while (isspace((unsigned char)*p)) p++;
- while (*p && (next = ldb_parse_filter(ret->u.list.elements, &p))) {
+ while (*p) {
+ if (*p == ')') {
+ break;
+ }
+
+ next = ldb_parse_filter(ret->u.list.elements, &p);
struct ldb_parse_tree **e;
+ if (next == NULL) {
+ /* an invalid filter element */
+ talloc_free(ret);
+ return NULL;
+ }
e = talloc_realloc(ret, ret->u.list.elements,
struct ldb_parse_tree *,
ret->u.list.num_elements + 1);