summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorTim Prouty <tprouty@samba.org>2009-01-23 16:09:13 -0800
committerTim Prouty <tprouty@samba.org>2009-01-23 16:18:21 -0800
commit0998d172dbeb5f9d7198bbea9ee9124c0558f41b (patch)
tree4a117fef67e1dffcb06ac58dd0c7d05c2b460a16 /source3/lib
parent48a6feef402f7b91098341dc6e5eabbfd4beaa91 (diff)
downloadsamba-0998d172dbeb5f9d7198bbea9ee9124c0558f41b.tar.gz
samba-0998d172dbeb5f9d7198bbea9ee9124c0558f41b.tar.bz2
samba-0998d172dbeb5f9d7198bbea9ee9124c0558f41b.zip
s3 ldb: Fix vasprintf segfault that has been the source of build machine failures this week
The bug was introduced when converting samba3's ldb_search interface to match samba4: 47951fc5d0085e124666b7667715bba98076820e f3ecb701335b1129947127d4c45eef970b66875c
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/ldb/common/ldb.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/source3/lib/ldb/common/ldb.c b/source3/lib/ldb/common/ldb.c
index 6e28528dbf..cef7373c26 100644
--- a/source3/lib/ldb/common/ldb.c
+++ b/source3/lib/ldb/common/ldb.c
@@ -808,15 +808,18 @@ int ldb_search(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, struct ldb_result *
va_list ap;
int ret;
+ expression = NULL;
res = NULL;
*result = NULL;
- va_start(ap, exp_fmt);
- expression = talloc_vasprintf(mem_ctx, exp_fmt, ap);
- va_end(ap);
+ if (exp_fmt) {
+ va_start(ap, exp_fmt);
+ expression = talloc_vasprintf(mem_ctx, exp_fmt, ap);
+ va_end(ap);
- if ( ! expression) {
- return LDB_ERR_OPERATIONS_ERROR;
+ if ( ! expression) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
}
ret = _ldb_search(ldb, ldb, &res, base, scope, attrs, expression);