Skip to content

Commit

Permalink
Fix unlikely double free in PKINIT client code
Browse files Browse the repository at this point in the history
In pa_pkinit_gen_req, if the cleanup handler is reached with non-zero
retval and non-null out_data, out_data is freed, then dereferenced,
then freed again.  This can only happen if one of the small fixed-size
malloc requests fails after pkinit_as_req_create succeeds, so it is
unlikely to occur in practice.

ticket: 7878 (new)
target_version: 1.12.2
tags: pullup
  • Loading branch information
greghudson committed Mar 18, 2014
1 parent cb3db58 commit cc002d6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/plugins/preauth/pkinit/pkinit_clnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ pa_pkinit_gen_req(krb5_context context,
cleanup:
if (der_req != NULL)
krb5_free_data(context, der_req);
free(out_data);

if (retval) {
if (return_pa_data) {
Expand All @@ -222,9 +221,9 @@ pa_pkinit_gen_req(krb5_context context,
}
if (out_data) {
free(out_data->data);
free(out_data);
}
}
free(out_data);
return retval;
}

Expand Down

0 comments on commit cc002d6

Please sign in to comment.