From b7270fbc9971b6e625c15a60e6717410aec2b77a Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Sun, 30 May 2010 20:46:31 +0200 Subject: s4:dsdb_module_search_dn - add code to handle NULL format string --- source4/dsdb/samdb/ldb_modules/util.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/util.c') diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c index c233df7216..37dc885a2d 100644 --- a/source4/dsdb/samdb/ldb_modules/util.c +++ b/source4/dsdb/samdb/ldb_modules/util.c @@ -113,12 +113,22 @@ int dsdb_module_search(struct ldb_module *module, tmp_ctx = talloc_new(mem_ctx); - va_start(ap, format); - expression = talloc_vasprintf(tmp_ctx, format, ap); - va_end(ap); + if (format) { + va_start(ap, format); + expression = talloc_vasprintf(tmp_ctx, format, ap); + va_end(ap); + + if (!expression) { + talloc_free(tmp_ctx); + return LDB_ERR_OPERATIONS_ERROR; + } + } else { + expression = NULL; + } res = talloc_zero(tmp_ctx, struct ldb_result); if (!res) { + talloc_free(tmp_ctx); return LDB_ERR_OPERATIONS_ERROR; } -- cgit