summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/a_set.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/a_set.c')
-rw-r--r--src/lib/libcrypto/asn1/a_set.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/lib/libcrypto/asn1/a_set.c b/src/lib/libcrypto/asn1/a_set.c
index 0f839822ff..e24061c545 100644
--- a/src/lib/libcrypto/asn1/a_set.c
+++ b/src/lib/libcrypto/asn1/a_set.c
@@ -118,8 +118,13 @@ int i2d_ASN1_SET(STACK *a, unsigned char **pp, int (*func)(), int ex_tag,
118 } 118 }
119 119
120 pStart = p; /* Catch the beg of Setblobs*/ 120 pStart = p; /* Catch the beg of Setblobs*/
121 if (!(rgSetBlob = (MYBLOB *)OPENSSL_malloc( sk_num(a) * sizeof(MYBLOB)))) return 0; /* In this array 121 /* In this array we will store the SET blobs */
122we will store the SET blobs */ 122 rgSetBlob = (MYBLOB *)OPENSSL_malloc(sk_num(a) * sizeof(MYBLOB));
123 if (rgSetBlob == NULL)
124 {
125 ASN1err(ASN1_F_I2D_ASN1_SET,ERR_R_MALLOC_FAILURE);
126 return(0);
127 }
123 128
124 for (i=0; i<sk_num(a); i++) 129 for (i=0; i<sk_num(a); i++)
125 { 130 {
@@ -135,7 +140,11 @@ SetBlob
135 /* Now we have to sort the blobs. I am using a simple algo. 140 /* Now we have to sort the blobs. I am using a simple algo.
136 *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/ 141 *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/
137 qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp); 142 qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp);
138 if (!(pTempMem = OPENSSL_malloc(totSize))) return 0; 143 if (!(pTempMem = OPENSSL_malloc(totSize)))
144 {
145 ASN1err(ASN1_F_I2D_ASN1_SET,ERR_R_MALLOC_FAILURE);
146 return(0);
147 }
139 148
140/* Copy to temp mem */ 149/* Copy to temp mem */
141 p = pTempMem; 150 p = pTempMem;
@@ -160,7 +169,13 @@ STACK *d2i_ASN1_SET(STACK **a, unsigned char **pp, long length,
160 STACK *ret=NULL; 169 STACK *ret=NULL;
161 170
162 if ((a == NULL) || ((*a) == NULL)) 171 if ((a == NULL) || ((*a) == NULL))
163 { if ((ret=sk_new_null()) == NULL) goto err; } 172 {
173 if ((ret=sk_new_null()) == NULL)
174 {
175 ASN1err(ASN1_F_D2I_ASN1_SET,ERR_R_MALLOC_FAILURE);
176 goto err;
177 }
178 }
164 else 179 else
165 ret=(*a); 180 ret=(*a);
166 181