summaryrefslogtreecommitdiffstats
path: root/source4
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2014-09-02 17:03:34 +1200
committerAndrew Bartlett <abartlet@samba.org>2014-09-08 07:26:34 +0200
commit34cc5bd260a9c7139d8d1e822f4e139e9c0ec2c0 (patch)
treeaec89cc8cde236c671702c0486272371cef33520 /source4
parente93affbe1b4ff32858988bde79d00cdc82729089 (diff)
downloadsamba-34cc5bd260a9c7139d8d1e822f4e139e9c0ec2c0.tar.gz
samba-34cc5bd260a9c7139d8d1e822f4e139e9c0ec2c0.tar.xz
samba-34cc5bd260a9c7139d8d1e822f4e139e9c0ec2c0.zip
winbindd: Do not use user_list->out.resume_index after free
Found by AddressSanitizer Change-Id: I9f8b95b65de788994a7404fa8889fce45ccb3a30 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Kamen Mazdrashki <kamenim@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/winbind/wb_cmd_setpwent.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source4/winbind/wb_cmd_setpwent.c b/source4/winbind/wb_cmd_setpwent.c
index 8164d6f199..ab9fd2ef94 100644
--- a/source4/winbind/wb_cmd_setpwent.c
+++ b/source4/winbind/wb_cmd_setpwent.c
@@ -115,6 +115,9 @@ static void cmd_setpwent_recv_user_list(struct composite_context *ctx)
user_list);
if (NT_STATUS_IS_OK(state->ctx->status) ||
NT_STATUS_EQUAL(state->ctx->status, STATUS_MORE_ENTRIES)) {
+
+ uint32_t resume_index = user_list->out.resume_index;
+
if (state->result->page_index == -1) { /* First run*/
state->result->user_list = user_list;
state->result->page_index = 0;
@@ -133,7 +136,7 @@ static void cmd_setpwent_recv_user_list(struct composite_context *ctx)
= talloc_strdup(state->result, user_list->out.users[i].username);
}
state->result->user_list->out.count = cnt;
- talloc_free(user_list);
+ TALLOC_FREE(user_list);
}
if (NT_STATUS_IS_OK(state->ctx->status) ) {
@@ -142,7 +145,7 @@ static void cmd_setpwent_recv_user_list(struct composite_context *ctx)
user_list_send = talloc(state->result, struct libnet_UserList);
if (composite_nomem(user_list_send, state->ctx)) return;
user_list_send->in.domain_name = talloc_strdup(state, state->domain_name);
- user_list_send->in.resume_index = user_list->out.resume_index;
+ user_list_send->in.resume_index = resume_index;
user_list_send->in.page_size = 128;
ctx = libnet_UserList_send(state->libnet_ctx, state->result, user_list_send, NULL);
composite_continue(state->ctx, ctx, cmd_setpwent_recv_user_list, state);