diff options
author | CodaFi <devteam.codafi@gmail.com> | 2014-03-06 21:41:01 -0700 |
---|---|---|
committer | CodaFi <devteam.codafi@gmail.com> | 2014-03-06 21:41:01 -0700 |
commit | bc37ad3040c04529fe882eb3db967e7afdd4111a (patch) | |
tree | f23f09c9b2f606e0438a390ef6bbc4bf1a1767de /src/core/security | |
parent | 99a310ac1115bf50a2fc4b71f27aab230d17a27a (diff) |
Handle NULL strings appropriately
Diffstat (limited to 'src/core/security')
-rw-r--r-- | src/core/security/MCCertificateUtils.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/core/security/MCCertificateUtils.cc b/src/core/security/MCCertificateUtils.cc index a5ac6a42..de7f649d 100644 --- a/src/core/security/MCCertificateUtils.cc +++ b/src/core/security/MCCertificateUtils.cc @@ -110,6 +110,9 @@ err: for(unsigned int i = 0 ; i < carray_count(cCerts) ; i ++) { MMAPString * str; str = (MMAPString *) carray_get(cCerts, i); + if (str == NULL) { + goto free_certs; + } BIO *bio = BIO_new_mem_buf((void *) str->str, str->len); X509 *certificate = d2i_X509_bio(bio, NULL); BIO_free(bio); @@ -136,8 +139,12 @@ err: free_certs: mailstream_certificate_chain_free(cCerts); sk_X509_pop_free((STACK_OF(X509) *) certificates, X509_free); - X509_STORE_CTX_free(storectx); - X509_STORE_free(store); + if (storectx != NULL) { + X509_STORE_CTX_free(storectx); + } + if (store != NULL) { + X509_STORE_free(store); + } err: return result; #endif |