diff options
author | 2014-05-29 21:19:30 +0000 | |
---|---|---|
committer | 2014-05-29 21:19:30 +0000 | |
commit | b97bb8916957ffa7f26ce1de08932774add04362 (patch) | |
tree | a55f45dd207dc2b67ea13f85afdd095f5c4792b4 /lib/libssl/src | |
parent | convert 53 malloc(a*b) to reallocarray(NULL, a, b). that is 53 (diff) | |
download | wireguard-openbsd-b97bb8916957ffa7f26ce1de08932774add04362.tar.xz wireguard-openbsd-b97bb8916957ffa7f26ce1de08932774add04362.zip |
ok, next pass after review: when possible, put the reallocarray arguments
in the "size_t nmemb, size_t size"
Diffstat (limited to 'lib/libssl/src')
-rw-r--r-- | lib/libssl/src/apps/apps.c | 2 | ||||
-rw-r--r-- | lib/libssl/src/apps/ca.c | 2 | ||||
-rw-r--r-- | lib/libssl/src/apps/ecparam.c | 2 | ||||
-rw-r--r-- | lib/libssl/src/crypto/bn/bn_gf2m.c | 10 | ||||
-rw-r--r-- | lib/libssl/src/crypto/bn/bn_lib.c | 2 | ||||
-rw-r--r-- | lib/libssl/src/crypto/ec/ec_mult.c | 2 | ||||
-rw-r--r-- | lib/libssl/src/crypto/lhash/lhash.c | 2 | ||||
-rw-r--r-- | lib/libssl/src/crypto/objects/obj_xref.c | 2 | ||||
-rw-r--r-- | lib/libssl/src/crypto/txt_db/txt_db.c | 4 | ||||
-rw-r--r-- | lib/libssl/src/crypto/x509v3/pcy_tree.c | 2 |
10 files changed, 15 insertions, 15 deletions
diff --git a/lib/libssl/src/apps/apps.c b/lib/libssl/src/apps/apps.c index a5ffee3e5f5..3b28a6f3cc1 100644 --- a/lib/libssl/src/apps/apps.c +++ b/lib/libssl/src/apps/apps.c @@ -214,7 +214,7 @@ chopup_args(ARGS *arg, char *buf, int *argc, char **argv[]) i = 0; if (arg->count == 0) { arg->count = 20; - arg->data = reallocarray(NULL, sizeof(char *), arg->count); + arg->data = reallocarray(NULL, arg->count, sizeof(char *)); } for (i = 0; i < arg->count; i++) arg->data[i] = NULL; diff --git a/lib/libssl/src/apps/ca.c b/lib/libssl/src/apps/ca.c index 89c4f84613b..bf32446f3bd 100644 --- a/lib/libssl/src/apps/ca.c +++ b/lib/libssl/src/apps/ca.c @@ -1974,7 +1974,7 @@ again2: row[DB_type][0] = 'V'; row[DB_type][1] = '\0'; - if ((irow = reallocarray(NULL, sizeof(char *), (DB_NUMBER + 1))) == + if ((irow = reallocarray(NULL, DB_NUMBER + 1, sizeof(char *))) == NULL) { BIO_printf(bio_err, "Memory allocation failure\n"); goto err; diff --git a/lib/libssl/src/apps/ecparam.c b/lib/libssl/src/apps/ecparam.c index 29eaf9ba1a7..e5c26c3ad0e 100644 --- a/lib/libssl/src/apps/ecparam.c +++ b/lib/libssl/src/apps/ecparam.c @@ -308,7 +308,7 @@ bad: crv_len = EC_get_builtin_curves(NULL, 0); - curves = reallocarray(NULL, sizeof(EC_builtin_curve), crv_len); + curves = reallocarray(NULL, crv_len, sizeof(EC_builtin_curve)); if (curves == NULL) goto end; diff --git a/lib/libssl/src/crypto/bn/bn_gf2m.c b/lib/libssl/src/crypto/bn/bn_gf2m.c index 4bd50924d30..f451befb0d3 100644 --- a/lib/libssl/src/crypto/bn/bn_gf2m.c +++ b/lib/libssl/src/crypto/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/lib/libssl/src/crypto/bn/bn_lib.c b/lib/libssl/src/crypto/bn/bn_lib.c index 28489f8181d..a4f0bdd34b6 100644 --- a/lib/libssl/src/crypto/bn/bn_lib.c +++ b/lib/libssl/src/crypto/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); diff --git a/lib/libssl/src/crypto/ec/ec_mult.c b/lib/libssl/src/crypto/ec/ec_mult.c index b3bd34d82df..0fd0cab2f1a 100644 --- a/lib/libssl/src/crypto/ec/ec_mult.c +++ b/lib/libssl/src/crypto/ec/ec_mult.c @@ -790,7 +790,7 @@ ec_wNAF_precompute_mult(EC_GROUP * group, BN_CTX * ctx) num = pre_points_per_block * numblocks; /* number of points to * compute and store */ - points = reallocarray(NULL, sizeof(EC_POINT *), (num + 1)); + points = reallocarray(NULL, (num + 1), sizeof(EC_POINT *)); if (!points) { ECerr(EC_F_EC_WNAF_PRECOMPUTE_MULT, ERR_R_MALLOC_FAILURE); goto err; diff --git a/lib/libssl/src/crypto/lhash/lhash.c b/lib/libssl/src/crypto/lhash/lhash.c index e75a43f5066..1e3359cfe06 100644 --- a/lib/libssl/src/crypto/lhash/lhash.c +++ b/lib/libssl/src/crypto/lhash/lhash.c @@ -119,7 +119,7 @@ lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c) if ((ret = malloc(sizeof(_LHASH))) == NULL) goto err0; - if ((ret->b = reallocarray(NULL, sizeof(LHASH_NODE *), MIN_NODES)) == NULL) + if ((ret->b = reallocarray(NULL, MIN_NODES, sizeof(LHASH_NODE *))) == NULL) goto err1; for (i = 0; i < MIN_NODES; i++) ret->b[i] = NULL; diff --git a/lib/libssl/src/crypto/objects/obj_xref.c b/lib/libssl/src/crypto/objects/obj_xref.c index 8e9128efc4b..2c1631e7734 100644 --- a/lib/libssl/src/crypto/objects/obj_xref.c +++ b/lib/libssl/src/crypto/objects/obj_xref.c @@ -164,7 +164,7 @@ OBJ_add_sigid(int signid, int dig_id, int pkey_id) sigx_app = sk_nid_triple_new(sigx_cmp); if (!sigx_app) return 0; - ntr = reallocarray(NULL, sizeof(int), 3); + ntr = reallocarray(NULL, 3, sizeof(int)); if (!ntr) return 0; ntr->sign_id = signid; diff --git a/lib/libssl/src/crypto/txt_db/txt_db.c b/lib/libssl/src/crypto/txt_db/txt_db.c index 0f3a7ffbb39..e29a60316ae 100644 --- a/lib/libssl/src/crypto/txt_db/txt_db.c +++ b/lib/libssl/src/crypto/txt_db/txt_db.c @@ -94,9 +94,9 @@ TXT_DB_read(BIO *in, int num) ret->qual = NULL; if ((ret->data = sk_OPENSSL_PSTRING_new_null()) == NULL) goto err; - if ((ret->index = reallocarray(NULL, sizeof(*ret->index), num)) == NULL) + if ((ret->index = reallocarray(NULL, num, sizeof(*ret->index))) == NULL) goto err; - if ((ret->qual = reallocarray(NULL, sizeof(*(ret->qual)), num)) == NULL) + if ((ret->qual = reallocarray(NULL, num, sizeof(*(ret->qual)))) == NULL) goto err; for (i = 0; i < num; i++) { ret->index[i] = NULL; diff --git a/lib/libssl/src/crypto/x509v3/pcy_tree.c b/lib/libssl/src/crypto/x509v3/pcy_tree.c index 080a87d6741..4aa83e027da 100644 --- a/lib/libssl/src/crypto/x509v3/pcy_tree.c +++ b/lib/libssl/src/crypto/x509v3/pcy_tree.c @@ -220,7 +220,7 @@ tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs, unsigned int flags) return 0; tree->flags = 0; - tree->levels = reallocarray(NULL, sizeof(X509_POLICY_LEVEL), n); + tree->levels = reallocarray(NULL, n, sizeof(X509_POLICY_LEVEL)); tree->nlevel = 0; tree->extra_data = NULL; tree->auth_policies = NULL; |