diff options
author | deraadt <> | 2014-05-29 21:07:43 +0000 |
---|---|---|
committer | deraadt <> | 2014-05-29 21:07:43 +0000 |
commit | 3d662abca6b2a7f5bc9108b036434d61fcdb6e53 (patch) | |
tree | d5fe0c330801f3e72c7b588264c6027636db4330 /src/lib/libcrypto/asn1/a_set.c | |
parent | d205a2aecb99564cccfbea61c39ebe3b0ddd7fb7 (diff) | |
download | openbsd-3d662abca6b2a7f5bc9108b036434d61fcdb6e53.tar.gz openbsd-3d662abca6b2a7f5bc9108b036434d61fcdb6e53.tar.bz2 openbsd-3d662abca6b2a7f5bc9108b036434d61fcdb6e53.zip |
convert 53 malloc(a*b) to reallocarray(NULL, a, b). that is 53
potential integer overflows easily changed into an allocation return
of NULL, with errno nicely set if need be. checks for an allocations
returning NULL are commonplace, or if the object is dereferenced
(quite normal) will result in a nice fault which can be detected &
repaired properly.
ok tedu
Diffstat (limited to 'src/lib/libcrypto/asn1/a_set.c')
-rw-r--r-- | src/lib/libcrypto/asn1/a_set.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/libcrypto/asn1/a_set.c b/src/lib/libcrypto/asn1/a_set.c index 3aeb7e54ff..8101f7722d 100644 --- a/src/lib/libcrypto/asn1/a_set.c +++ b/src/lib/libcrypto/asn1/a_set.c | |||
@@ -121,7 +121,7 @@ i2d_ASN1_SET(STACK_OF(OPENSSL_BLOCK) *a, unsigned char **pp, i2d_of_void *i2d, | |||
121 | 121 | ||
122 | pStart = p; /* Catch the beg of Setblobs*/ | 122 | pStart = p; /* Catch the beg of Setblobs*/ |
123 | /* In this array we will store the SET blobs */ | 123 | /* In this array we will store the SET blobs */ |
124 | rgSetBlob = malloc(sk_OPENSSL_BLOCK_num(a) * sizeof(MYBLOB)); | 124 | rgSetBlob = reallocarray(NULL, sk_OPENSSL_BLOCK_num(a), sizeof(MYBLOB)); |
125 | if (rgSetBlob == NULL) { | 125 | if (rgSetBlob == NULL) { |
126 | ASN1err(ASN1_F_I2D_ASN1_SET, ERR_R_MALLOC_FAILURE); | 126 | ASN1err(ASN1_F_I2D_ASN1_SET, ERR_R_MALLOC_FAILURE); |
127 | return 0; | 127 | return 0; |