1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-23 09:57:40 +03:00

torture: Fix use-after-free in ldap.nested-search

Found by AddressSanitizer

Change-Id: Ie3bb4054201382cacb4b296308d561a3548f8cff
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Andrew Bartlett 2014-09-04 14:06:40 +12:00
parent edda534454
commit a744dba3b9

View File

@ -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;
}