diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/a_int.c')
-rw-r--r-- | src/lib/libcrypto/asn1/a_int.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/libcrypto/asn1/a_int.c b/src/lib/libcrypto/asn1/a_int.c index 05776f572c..0559cce384 100644 --- a/src/lib/libcrypto/asn1/a_int.c +++ b/src/lib/libcrypto/asn1/a_int.c | |||
@@ -205,7 +205,7 @@ c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, long len) | |||
205 | 205 | ||
206 | /* We must malloc stuff, even for 0 bytes otherwise it | 206 | /* We must malloc stuff, even for 0 bytes otherwise it |
207 | * signifies a missing NULL parameter. */ | 207 | * signifies a missing NULL parameter. */ |
208 | s = (unsigned char *)malloc((int)len + 1); | 208 | s = malloc((int)len + 1); |
209 | if (s == NULL) { | 209 | if (s == NULL) { |
210 | i = ERR_R_MALLOC_FAILURE; | 210 | i = ERR_R_MALLOC_FAILURE; |
211 | goto err; | 211 | goto err; |
@@ -309,7 +309,7 @@ d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, long length) | |||
309 | 309 | ||
310 | /* We must malloc stuff, even for 0 bytes otherwise it | 310 | /* We must malloc stuff, even for 0 bytes otherwise it |
311 | * signifies a missing NULL parameter. */ | 311 | * signifies a missing NULL parameter. */ |
312 | s = (unsigned char *)malloc((int)len + 1); | 312 | s = malloc((int)len + 1); |
313 | if (s == NULL) { | 313 | if (s == NULL) { |
314 | i = ERR_R_MALLOC_FAILURE; | 314 | i = ERR_R_MALLOC_FAILURE; |
315 | goto err; | 315 | goto err; |
@@ -352,8 +352,7 @@ ASN1_INTEGER_set(ASN1_INTEGER *a, long v) | |||
352 | if (a->length < (int)(sizeof(long) + 1)) { | 352 | if (a->length < (int)(sizeof(long) + 1)) { |
353 | if (a->data != NULL) | 353 | if (a->data != NULL) |
354 | free(a->data); | 354 | free(a->data); |
355 | if ((a->data = (unsigned char *)malloc(sizeof(long) + 1)) != NULL) | 355 | a->data = calloc(1, sizeof(long) + 1); |
356 | memset((char *)a->data, 0, sizeof(long) + 1); | ||
357 | } | 356 | } |
358 | if (a->data == NULL) { | 357 | if (a->data == NULL) { |
359 | ASN1err(ASN1_F_ASN1_INTEGER_SET, ERR_R_MALLOC_FAILURE); | 358 | ASN1err(ASN1_F_ASN1_INTEGER_SET, ERR_R_MALLOC_FAILURE); |