Loading crypto/asn1/a_enum.c +11 −1 Original line number Diff line number Diff line Loading @@ -151,7 +151,17 @@ ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai) else ret->type=V_ASN1_ENUMERATED; j=BN_num_bits(bn); len=((j == 0)?0:((j/8)+1)); ret->data=(unsigned char *)OPENSSL_malloc(len+4); if (ret->length < len+4) { char *new_data=(char *)OPENSSL_realloc(ret->data, len+4); if (!new_data) { ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_MALLOC_FAILURE); goto err; } ret->data=new_data; } ret->length=BN_bn2bin(bn,ret->data); return(ret); err: Loading crypto/asn1/a_int.c +10 −1 Original line number Diff line number Diff line Loading @@ -397,7 +397,16 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai) else ret->type=V_ASN1_INTEGER; j=BN_num_bits(bn); len=((j == 0)?0:((j/8)+1)); ret->data=(unsigned char *)OPENSSL_malloc(len+4); if (ret->length < len+4) { char *new_data=(char *)OPENSSL_realloc(ret->data, len+4); if (!new_data) { ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_MALLOC_FAILURE); goto err; } ret->data=new_data; } ret->length=BN_bn2bin(bn,ret->data); /* Correct zero case */ if(!ret->length) Loading crypto/asn1/a_set.c +2 −2 Original line number Diff line number Diff line Loading @@ -118,7 +118,7 @@ int i2d_ASN1_SET(STACK *a, unsigned char **pp, int (*func)(), int ex_tag, } pStart = p; /* Catch the beg of Setblobs*/ rgSetBlob = (MYBLOB *)OPENSSL_malloc( sk_num(a) * sizeof(MYBLOB)); /* In this array if (!(rgSetBlob = (MYBLOB *)OPENSSL_malloc( sk_num(a) * sizeof(MYBLOB)))) return 0; /* In this array we will store the SET blobs */ for (i=0; i<sk_num(a); i++) Loading @@ -135,7 +135,7 @@ SetBlob /* Now we have to sort the blobs. I am using a simple algo. *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/ qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp); pTempMem = OPENSSL_malloc(totSize); if (!(pTempMem = OPENSSL_malloc(totSize))) return 0; /* Copy to temp mem */ p = pTempMem; Loading crypto/asn1/x_pubkey.c +6 −2 Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) dsa->write_params=0; ASN1_TYPE_free(a->parameter); i=i2d_DSAparams(dsa,NULL); p=(unsigned char *)OPENSSL_malloc(i); if ((p=(unsigned char *)OPENSSL_malloc(i)) == NULL) goto err; pp=p; i2d_DSAparams(dsa,&pp); a->parameter=ASN1_TYPE_new(); Loading Loading @@ -189,7 +189,11 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) } if ((i=i2d_PublicKey(pkey,NULL)) <= 0) goto err; if ((s=(unsigned char *)OPENSSL_malloc(i+1)) == NULL) goto err; if ((s=(unsigned char *)OPENSSL_malloc(i+1)) == NULL) { X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); goto err; } p=s; i2d_PublicKey(pkey,&p); if (!M_ASN1_BIT_STRING_set(pk->public_key,s,i)) goto err; Loading crypto/bio/bf_nbio.c +1 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ static int nbiof_new(BIO *bi) { NBIO_TEST *nt; nt=(NBIO_TEST *)OPENSSL_malloc(sizeof(NBIO_TEST)); if (!(nt=(NBIO_TEST *)OPENSSL_malloc(sizeof(NBIO_TEST)))) return(0); nt->lrn= -1; nt->lwn= -1; bi->ptr=(char *)nt; Loading Loading
crypto/asn1/a_enum.c +11 −1 Original line number Diff line number Diff line Loading @@ -151,7 +151,17 @@ ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai) else ret->type=V_ASN1_ENUMERATED; j=BN_num_bits(bn); len=((j == 0)?0:((j/8)+1)); ret->data=(unsigned char *)OPENSSL_malloc(len+4); if (ret->length < len+4) { char *new_data=(char *)OPENSSL_realloc(ret->data, len+4); if (!new_data) { ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_MALLOC_FAILURE); goto err; } ret->data=new_data; } ret->length=BN_bn2bin(bn,ret->data); return(ret); err: Loading
crypto/asn1/a_int.c +10 −1 Original line number Diff line number Diff line Loading @@ -397,7 +397,16 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai) else ret->type=V_ASN1_INTEGER; j=BN_num_bits(bn); len=((j == 0)?0:((j/8)+1)); ret->data=(unsigned char *)OPENSSL_malloc(len+4); if (ret->length < len+4) { char *new_data=(char *)OPENSSL_realloc(ret->data, len+4); if (!new_data) { ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_MALLOC_FAILURE); goto err; } ret->data=new_data; } ret->length=BN_bn2bin(bn,ret->data); /* Correct zero case */ if(!ret->length) Loading
crypto/asn1/a_set.c +2 −2 Original line number Diff line number Diff line Loading @@ -118,7 +118,7 @@ int i2d_ASN1_SET(STACK *a, unsigned char **pp, int (*func)(), int ex_tag, } pStart = p; /* Catch the beg of Setblobs*/ rgSetBlob = (MYBLOB *)OPENSSL_malloc( sk_num(a) * sizeof(MYBLOB)); /* In this array if (!(rgSetBlob = (MYBLOB *)OPENSSL_malloc( sk_num(a) * sizeof(MYBLOB)))) return 0; /* In this array we will store the SET blobs */ for (i=0; i<sk_num(a); i++) Loading @@ -135,7 +135,7 @@ SetBlob /* Now we have to sort the blobs. I am using a simple algo. *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/ qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp); pTempMem = OPENSSL_malloc(totSize); if (!(pTempMem = OPENSSL_malloc(totSize))) return 0; /* Copy to temp mem */ p = pTempMem; Loading
crypto/asn1/x_pubkey.c +6 −2 Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) dsa->write_params=0; ASN1_TYPE_free(a->parameter); i=i2d_DSAparams(dsa,NULL); p=(unsigned char *)OPENSSL_malloc(i); if ((p=(unsigned char *)OPENSSL_malloc(i)) == NULL) goto err; pp=p; i2d_DSAparams(dsa,&pp); a->parameter=ASN1_TYPE_new(); Loading Loading @@ -189,7 +189,11 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) } if ((i=i2d_PublicKey(pkey,NULL)) <= 0) goto err; if ((s=(unsigned char *)OPENSSL_malloc(i+1)) == NULL) goto err; if ((s=(unsigned char *)OPENSSL_malloc(i+1)) == NULL) { X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); goto err; } p=s; i2d_PublicKey(pkey,&p); if (!M_ASN1_BIT_STRING_set(pk->public_key,s,i)) goto err; Loading
crypto/bio/bf_nbio.c +1 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ static int nbiof_new(BIO *bi) { NBIO_TEST *nt; nt=(NBIO_TEST *)OPENSSL_malloc(sizeof(NBIO_TEST)); if (!(nt=(NBIO_TEST *)OPENSSL_malloc(sizeof(NBIO_TEST)))) return(0); nt->lrn= -1; nt->lwn= -1; bi->ptr=(char *)nt; Loading