Skip to content

Commit

Permalink
Correct error handling bug in prior commit
Browse files Browse the repository at this point in the history
In crypto_encode_der_cert(), if the second i2d_X509() invocation
fails, make sure to free the allocated pointer and not the
possibly-modified alias.

ticket: 8561
  • Loading branch information
greghudson committed Mar 23, 2017
1 parent 89634ca commit 7fdaef7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
Expand Up @@ -6114,10 +6114,10 @@ crypto_encode_der_cert(krb5_context context, pkinit_req_crypto_context reqctx,
if (len <= 0)
return EINVAL;
p = der = malloc(len);
if (p == NULL)
if (der == NULL)
return ENOMEM;
if (i2d_X509(reqctx->received_cert, &p) <= 0) {
free(p);
free(der);
return EINVAL;
}
*der_out = der;
Expand Down

0 comments on commit 7fdaef7

Please sign in to comment.