提交 9a260103 编写于 作者: D Dr. Stephen Henson

Fix crahses and leaks in pkcs12 utility -chain option

上级 fbb311a7
...@@ -508,9 +508,10 @@ int MAIN(int argc, char **argv) ...@@ -508,9 +508,10 @@ int MAIN(int argc, char **argv)
/* Exclude verified certificate */ /* Exclude verified certificate */
for (i = 1; i < sk_X509_num (chain2) ; i++) for (i = 1; i < sk_X509_num (chain2) ; i++)
sk_X509_push(certs, sk_X509_value (chain2, i)); sk_X509_push(certs, sk_X509_value (chain2, i));
} /* Free first certificate */
X509_free(sk_X509_value(chain2, 0));
sk_X509_free(chain2); sk_X509_free(chain2);
if (vret) { } else {
BIO_printf (bio_err, "Error %s getting chain.\n", BIO_printf (bio_err, "Error %s getting chain.\n",
X509_verify_cert_error_string(vret)); X509_verify_cert_error_string(vret));
goto export_end; goto export_end;
...@@ -537,8 +538,6 @@ int MAIN(int argc, char **argv) ...@@ -537,8 +538,6 @@ int MAIN(int argc, char **argv)
} }
sk_X509_pop_free(certs, X509_free); sk_X509_pop_free(certs, X509_free);
certs = NULL; certs = NULL;
/* ucert is part of certs so it is already freed */
ucert = NULL;
#ifdef CRYPTO_MDEBUG #ifdef CRYPTO_MDEBUG
CRYPTO_pop_info(); CRYPTO_pop_info();
...@@ -627,7 +626,6 @@ int MAIN(int argc, char **argv) ...@@ -627,7 +626,6 @@ int MAIN(int argc, char **argv)
if (certs) sk_X509_pop_free(certs, X509_free); if (certs) sk_X509_pop_free(certs, X509_free);
if (safes) sk_PKCS7_pop_free(safes, PKCS7_free); if (safes) sk_PKCS7_pop_free(safes, PKCS7_free);
if (bags) sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free); if (bags) sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free);
if (ucert) X509_free(ucert);
#ifdef CRYPTO_MDEBUG #ifdef CRYPTO_MDEBUG
CRYPTO_pop_info(); CRYPTO_pop_info();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册