From a744dba3b9c140117613ddec8affd781ab82da87 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 4 Sep 2014 14:06:40 +1200 Subject: torture: Fix use-after-free in ldap.nested-search Found by AddressSanitizer Change-Id: Ie3bb4054201382cacb4b296308d561a3548f8cff Signed-off-by: Andrew Bartlett Reviewed-by: Stefan Metzmacher --- source4/torture/ldap/nested_search.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source4/torture/ldap') diff --git a/source4/torture/ldap/nested_search.c b/source4/torture/ldap/nested_search.c index 47299c2c213..9699919ecc1 100644 --- a/source4/torture/ldap/nested_search.c +++ b/source4/torture/ldap/nested_search.c @@ -60,11 +60,13 @@ static int nested_search_callback(struct ldb_request *req, "defaultNamingContext", NULL }; + enum ldb_reply_type type; sctx = talloc_get_type(req->context, struct nested_search_context); + type = ares->type; /* sanity check */ - switch (ares->type) { + switch (type) { case LDB_REPLY_ENTRY: torture_comment(sctx->tctx, "nested_search_callback: LDB_REPLY_ENTRY\n"); ldb_msg = ares->message; @@ -89,7 +91,7 @@ static int nested_search_callback(struct ldb_request *req, } /* not a search reply, then get out */ - if (ares->type != LDB_REPLY_ENTRY) { + if (type != LDB_REPLY_ENTRY) { return res; } -- cgit v1.2.1