Skip to content

Commit

Permalink
auth: Access always first entry when flushing failures
Browse files Browse the repository at this point in the history
The code is deleting the first item after accessing
it, and then moving forward. It will eventually go
beyond the array and get NULL ptr and fail.

Instead we need to always get the first item,
since the array deletion is moving the queued items
forward.

Broken by e18b4e4
  • Loading branch information
cmouse authored and villesavolainen committed Jun 6, 2017
1 parent eebd877 commit a5704dd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/auth/auth-request-handler.c
Expand Up @@ -843,9 +843,10 @@ void auth_request_handler_flush_failures(bool flush_all)

/* flush the requests */
for (i = 0; i < count; i++) {
auth_request = auth_requests[aqueue_idx(auth_failures, i)];
auth_request = auth_requests[aqueue_idx(auth_failures, 0)];
aqueue_delete_tail(auth_failures);

i_assert(auth_request != NULL);
i_assert(auth_request->state == AUTH_REQUEST_STATE_FINISHED);
auth_request_handler_reply(auth_request,
AUTH_CLIENT_RESULT_FAILURE,
Expand Down

0 comments on commit a5704dd

Please sign in to comment.