Skip to content

Commit

Permalink
Don't leak PKINIT CMS signed data certs and CRLs
Browse files Browse the repository at this point in the history
The stacks of certificates and CRLs that we retrieve from CMS objects
include newly-owned references to the certificates and CRLs, so when we
go to free them, we need to remember to free those.

[ghudson@mit.edu: minor formatting change; removed unrelated style fix]
  • Loading branch information
nalind authored and greghudson committed Jul 15, 2013
1 parent 40d61fe commit 04444a2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,10 @@ pkinit_pkcs11_code_to_text(int err);
#include <openssl/cms.h>
#define pkinit_CMS_get0_content_signed(_cms) CMS_get0_content(_cms)
#define pkinit_CMS_get0_content_data(_cms) CMS_get0_content(_cms)
#define pkinit_CMS_free1_crls(_sk_x509crl) sk_X509_CRL_free((_sk_x509crl))
#define pkinit_CMS_free1_certs(_sk_x509) sk_X509_free((_sk_x509))
#define pkinit_CMS_free1_crls(_sk_x509crl) \
sk_X509_CRL_pop_free((_sk_x509crl), X509_CRL_free)
#define pkinit_CMS_free1_certs(_sk_x509) \
sk_X509_pop_free((_sk_x509), X509_free)
#define pkinit_CMS_SignerInfo_get_cert(_cms,_si,_x509_pp) \
CMS_SignerInfo_get0_algs(_si,NULL,_x509_pp,NULL,NULL)
#else
Expand Down

0 comments on commit 04444a2

Please sign in to comment.