krb5 commit: Correct error handling bug in prior commit
Greg Hudson
ghudson at mit.edu
Thu Mar 23 14:24:50 EDT 2017
https://github.com/krb5/krb5/commit/7fdaef7c3280c86b5df25ae061fb04cc56d8620c
commit 7fdaef7c3280c86b5df25ae061fb04cc56d8620c
Author: Greg Hudson <ghudson at mit.edu>
Date: Thu Mar 23 13:42:55 2017 -0400
Correct error handling bug in prior commit
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
src/plugins/preauth/pkinit/pkinit_crypto_openssl.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
index a1ba911..be4fc47 100644
--- a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
+++ b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
@@ -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;
More information about the cvs-krb5
mailing list