diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/x_pubkey.c')
| -rw-r--r-- | src/lib/libcrypto/asn1/x_pubkey.c | 10 | 
1 files changed, 7 insertions, 3 deletions
| diff --git a/src/lib/libcrypto/asn1/x_pubkey.c b/src/lib/libcrypto/asn1/x_pubkey.c index 55630294b6..d958540120 100644 --- a/src/lib/libcrypto/asn1/x_pubkey.c +++ b/src/lib/libcrypto/asn1/x_pubkey.c | |||
| @@ -84,7 +84,7 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) | |||
| 84 | X509_PUBKEY *pk; | 84 | X509_PUBKEY *pk; | 
| 85 | X509_ALGOR *a; | 85 | X509_ALGOR *a; | 
| 86 | ASN1_OBJECT *o; | 86 | ASN1_OBJECT *o; | 
| 87 | unsigned char *s,*p; | 87 | unsigned char *s,*p = NULL; | 
| 88 | int i; | 88 | int i; | 
| 89 | 89 | ||
| 90 | if (x == NULL) return(0); | 90 | if (x == NULL) return(0); | 
| @@ -119,7 +119,7 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) | |||
| 119 | dsa->write_params=0; | 119 | dsa->write_params=0; | 
| 120 | ASN1_TYPE_free(a->parameter); | 120 | ASN1_TYPE_free(a->parameter); | 
| 121 | i=i2d_DSAparams(dsa,NULL); | 121 | i=i2d_DSAparams(dsa,NULL); | 
| 122 | p=(unsigned char *)OPENSSL_malloc(i); | 122 | if ((p=(unsigned char *)OPENSSL_malloc(i)) == NULL) goto err; | 
| 123 | pp=p; | 123 | pp=p; | 
| 124 | i2d_DSAparams(dsa,&pp); | 124 | i2d_DSAparams(dsa,&pp); | 
| 125 | a->parameter=ASN1_TYPE_new(); | 125 | a->parameter=ASN1_TYPE_new(); | 
| @@ -136,7 +136,11 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) | |||
| 136 | } | 136 | } | 
| 137 | 137 | ||
| 138 | if ((i=i2d_PublicKey(pkey,NULL)) <= 0) goto err; | 138 | if ((i=i2d_PublicKey(pkey,NULL)) <= 0) goto err; | 
| 139 | if ((s=(unsigned char *)OPENSSL_malloc(i+1)) == NULL) goto err; | 139 | if ((s=(unsigned char *)OPENSSL_malloc(i+1)) == NULL) | 
| 140 | { | ||
| 141 | X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); | ||
| 142 | goto err; | ||
| 143 | } | ||
| 140 | p=s; | 144 | p=s; | 
| 141 | i2d_PublicKey(pkey,&p); | 145 | i2d_PublicKey(pkey,&p); | 
| 142 | if (!M_ASN1_BIT_STRING_set(pk->public_key,s,i)) goto err; | 146 | if (!M_ASN1_BIT_STRING_set(pk->public_key,s,i)) goto err; | 
