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

Fix things so DH_free() will be no-op when passed NULL, like RSA_free() and

DSA_free(): this was causing crashes when for example an attempt was made
to handle a (currently) unsupported DH public key. Also X509_PUBKEY_set()i
wasn't checking errors from d2i_PublicKey().
上级 e416ad97
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
Changes between 0.9.1c and 0.9.2 Changes between 0.9.1c and 0.9.2
*) Make DH_free() tolerate being passed a NULL pointer (like RSA_free() and
DSA_free()). Make X509_PUBKEY_set() check for errors in d2i_PublicKey().
*) X509_name_add_entry() freed the wrong thing after an error. *) X509_name_add_entry() freed the wrong thing after an error.
[Arne Ansper <arne@ats.cyber.ee>] [Arne Ansper <arne@ats.cyber.ee>]
...@@ -23,7 +26,7 @@ ...@@ -23,7 +26,7 @@
[Ralf S. Engelschall] [Ralf S. Engelschall]
*) Fix the various library and apps files to free up pkeys obtained from *) Fix the various library and apps files to free up pkeys obtained from
EVP_PUBKEY_get() et al. Also allow x509.c to handle netscape extensions. X509_PUBKEY_get() et al. Also allow x509.c to handle netscape extensions.
[Steve Henson] [Steve Henson]
*) Fix reference counting in X509_PUBKEY_get(). This makes *) Fix reference counting in X509_PUBKEY_get(). This makes
......
...@@ -183,7 +183,7 @@ EVP_PKEY *pkey; ...@@ -183,7 +183,7 @@ EVP_PKEY *pkey;
goto err; goto err;
} }
i=i2d_PublicKey(pkey,NULL); if ((i=i2d_PublicKey(pkey,NULL)) <= 0) goto err;
if ((s=(unsigned char *)Malloc(i+1)) == NULL) goto err; if ((s=(unsigned char *)Malloc(i+1)) == NULL) goto err;
p=s; p=s;
i2d_PublicKey(pkey,&p); i2d_PublicKey(pkey,&p);
......
...@@ -88,6 +88,7 @@ DH *DH_new() ...@@ -88,6 +88,7 @@ DH *DH_new()
void DH_free(r) void DH_free(r)
DH *r; DH *r;
{ {
if(r == NULL) return;
if (r->p != NULL) BN_clear_free(r->p); if (r->p != NULL) BN_clear_free(r->p);
if (r->g != NULL) BN_clear_free(r->g); if (r->g != NULL) BN_clear_free(r->g);
if (r->pub_key != NULL) BN_clear_free(r->pub_key); if (r->pub_key != NULL) BN_clear_free(r->pub_key);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册