diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-05-29 21:07:44 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-05-29 21:07:44 +0000 |
commit | 23e318bc3fe7526bacb503f5b14da8aee3502871 (patch) | |
tree | 995dde2c607d492c07a8f8e71f0c0d56b8271549 /lib/libcrypto/x509 | |
parent | 4b83ed84c358f5a49df194b2f225f69533870f5c (diff) |
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 'lib/libcrypto/x509')
-rw-r--r-- | lib/libcrypto/x509/x509spki.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libcrypto/x509/x509spki.c b/lib/libcrypto/x509/x509spki.c index b5f67b5a97c..23172fdb8ee 100644 --- a/lib/libcrypto/x509/x509spki.c +++ b/lib/libcrypto/x509/x509spki.c @@ -115,7 +115,7 @@ NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *spki) int der_len; der_len = i2d_NETSCAPE_SPKI(spki, NULL); der_spki = malloc(der_len); - b64_str = malloc(der_len * 2); + b64_str = reallocarray(NULL, der_len, 2); if (!der_spki || !b64_str) { X509err(X509_F_NETSCAPE_SPKI_B64_ENCODE, ERR_R_MALLOC_FAILURE); free(der_spki); |