From 44c9da02b72b146dbbcafcaec3c3976d04f5c0df Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Thu, 29 May 2014 21:19:30 +0000 Subject: ok, next pass after review: when possible, put the reallocarray arguments in the "size_t nmemb, size_t size" --- src/lib/libcrypto/bn/bn_gf2m.c | 10 +++++----- src/lib/libcrypto/bn/bn_lib.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/lib/libcrypto/bn') diff --git a/src/lib/libcrypto/bn/bn_gf2m.c b/src/lib/libcrypto/bn/bn_gf2m.c index 4bd50924d3..f451befb0d 100644 --- a/src/lib/libcrypto/bn/bn_gf2m.c +++ b/src/lib/libcrypto/bn/bn_gf2m.c @@ -547,7 +547,7 @@ BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, bn_check_top(a); bn_check_top(b); bn_check_top(p); - if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL) + if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL) goto err; ret = BN_GF2m_poly2arr(p, arr, max); if (!ret || ret > max) { @@ -609,7 +609,7 @@ BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) bn_check_top(a); bn_check_top(p); - if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL) + if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL) goto err; ret = BN_GF2m_poly2arr(p, arr, max); if (!ret || ret > max) { @@ -1037,7 +1037,7 @@ BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, bn_check_top(a); bn_check_top(b); bn_check_top(p); - if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL) + if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL) goto err; ret = BN_GF2m_poly2arr(p, arr, max); if (!ret || ret > max) { @@ -1099,7 +1099,7 @@ BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) int *arr = NULL; bn_check_top(a); bn_check_top(p); - if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL) + if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL) goto err; ret = BN_GF2m_poly2arr(p, arr, max); if (!ret || ret > max) { @@ -1234,7 +1234,7 @@ BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) bn_check_top(a); bn_check_top(p); - if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL) + if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL) goto err; ret = BN_GF2m_poly2arr(p, arr, max); if (!ret || ret > max) { diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index 28489f8181..a4f0bdd34b 100644 --- a/src/lib/libcrypto/bn/bn_lib.c +++ b/src/lib/libcrypto/bn/bn_lib.c @@ -278,7 +278,7 @@ bn_expand_internal(const BIGNUM *b, int words) BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return (NULL); } - a = A = reallocarray(NULL, sizeof(BN_ULONG), words); + a = A = reallocarray(NULL, words, sizeof(BN_ULONG)); if (A == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return (NULL); -- cgit v1.2.3-55-g6feb