summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/engine
diff options
context:
space:
mode:
authorderaadt <>2014-05-29 21:07:43 +0000
committerderaadt <>2014-05-29 21:07:43 +0000
commit642d45ae22413aa8195b105d051ca8896e782c5d (patch)
treed5fe0c330801f3e72c7b588264c6027636db4330 /src/lib/libcrypto/engine
parentf60b3b3365842d8869513a7e36981671cd726939 (diff)
downloadopenbsd-642d45ae22413aa8195b105d051ca8896e782c5d.tar.gz
openbsd-642d45ae22413aa8195b105d051ca8896e782c5d.tar.bz2
openbsd-642d45ae22413aa8195b105d051ca8896e782c5d.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/engine')
-rw-r--r--src/lib/libcrypto/engine/eng_rsax.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/libcrypto/engine/eng_rsax.c b/src/lib/libcrypto/engine/eng_rsax.c
index 1b15b6f1a3..0f8e1cd498 100644
--- a/src/lib/libcrypto/engine/eng_rsax.c
+++ b/src/lib/libcrypto/engine/eng_rsax.c
@@ -268,7 +268,7 @@ static E_RSAX_MOD_CTX *e_rsax_get_ctx(RSA *rsa, int idx, BIGNUM* m)
268 268
269 hptr = RSA_get_ex_data(rsa, rsax_ex_data_idx); 269 hptr = RSA_get_ex_data(rsa, rsax_ex_data_idx);
270 if (!hptr) { 270 if (!hptr) {
271 hptr = malloc(3*sizeof(E_RSAX_MOD_CTX)); 271 hptr = reallocarray(NULL, 3, sizeof(E_RSAX_MOD_CTX));
272 if (!hptr) return NULL; 272 if (!hptr) return NULL;
273 hptr[2].type = hptr[1].type= hptr[0].type = 0; 273 hptr[2].type = hptr[1].type= hptr[0].type = 0;
274 RSA_set_ex_data(rsa, rsax_ex_data_idx, hptr); 274 RSA_set_ex_data(rsa, rsax_ex_data_idx, hptr);