summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorderaadt <>2014-05-29 21:19:30 +0000
committerderaadt <>2014-05-29 21:19:30 +0000
commite36774a3cfbf9430a020ae98951cce7b70f75c00 (patch)
tree956fc9edb289b1e8d01f4d38b053f5348ad99c38
parent3d662abca6b2a7f5bc9108b036434d61fcdb6e53 (diff)
downloadopenbsd-e36774a3cfbf9430a020ae98951cce7b70f75c00.tar.gz
openbsd-e36774a3cfbf9430a020ae98951cce7b70f75c00.tar.bz2
openbsd-e36774a3cfbf9430a020ae98951cce7b70f75c00.zip
ok, next pass after review: when possible, put the reallocarray arguments
in the "size_t nmemb, size_t size"
-rw-r--r--src/lib/libcrypto/bn/bn_gf2m.c10
-rw-r--r--src/lib/libcrypto/bn/bn_lib.c2
-rw-r--r--src/lib/libcrypto/ec/ec_mult.c2
-rw-r--r--src/lib/libcrypto/lhash/lhash.c2
-rw-r--r--src/lib/libcrypto/objects/obj_xref.c2
-rw-r--r--src/lib/libcrypto/txt_db/txt_db.c4
-rw-r--r--src/lib/libcrypto/x509v3/pcy_tree.c2
-rw-r--r--src/lib/libssl/src/apps/apps.c2
-rw-r--r--src/lib/libssl/src/apps/ca.c2
-rw-r--r--src/lib/libssl/src/apps/ecparam.c2
-rw-r--r--src/lib/libssl/src/crypto/bn/bn_gf2m.c10
-rw-r--r--src/lib/libssl/src/crypto/bn/bn_lib.c2
-rw-r--r--src/lib/libssl/src/crypto/ec/ec_mult.c2
-rw-r--r--src/lib/libssl/src/crypto/lhash/lhash.c2
-rw-r--r--src/lib/libssl/src/crypto/objects/obj_xref.c2
-rw-r--r--src/lib/libssl/src/crypto/txt_db/txt_db.c4
-rw-r--r--src/lib/libssl/src/crypto/x509v3/pcy_tree.c2
17 files changed, 27 insertions, 27 deletions
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,
547 bn_check_top(a); 547 bn_check_top(a);
548 bn_check_top(b); 548 bn_check_top(b);
549 bn_check_top(p); 549 bn_check_top(p);
550 if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL) 550 if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL)
551 goto err; 551 goto err;
552 ret = BN_GF2m_poly2arr(p, arr, max); 552 ret = BN_GF2m_poly2arr(p, arr, max);
553 if (!ret || ret > max) { 553 if (!ret || ret > max) {
@@ -609,7 +609,7 @@ BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
609 609
610 bn_check_top(a); 610 bn_check_top(a);
611 bn_check_top(p); 611 bn_check_top(p);
612 if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL) 612 if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL)
613 goto err; 613 goto err;
614 ret = BN_GF2m_poly2arr(p, arr, max); 614 ret = BN_GF2m_poly2arr(p, arr, max);
615 if (!ret || ret > max) { 615 if (!ret || ret > max) {
@@ -1037,7 +1037,7 @@ BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p,
1037 bn_check_top(a); 1037 bn_check_top(a);
1038 bn_check_top(b); 1038 bn_check_top(b);
1039 bn_check_top(p); 1039 bn_check_top(p);
1040 if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL) 1040 if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL)
1041 goto err; 1041 goto err;
1042 ret = BN_GF2m_poly2arr(p, arr, max); 1042 ret = BN_GF2m_poly2arr(p, arr, max);
1043 if (!ret || ret > max) { 1043 if (!ret || ret > max) {
@@ -1099,7 +1099,7 @@ BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
1099 int *arr = NULL; 1099 int *arr = NULL;
1100 bn_check_top(a); 1100 bn_check_top(a);
1101 bn_check_top(p); 1101 bn_check_top(p);
1102 if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL) 1102 if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL)
1103 goto err; 1103 goto err;
1104 ret = BN_GF2m_poly2arr(p, arr, max); 1104 ret = BN_GF2m_poly2arr(p, arr, max);
1105 if (!ret || ret > max) { 1105 if (!ret || ret > max) {
@@ -1234,7 +1234,7 @@ BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
1234 1234
1235 bn_check_top(a); 1235 bn_check_top(a);
1236 bn_check_top(p); 1236 bn_check_top(p);
1237 if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL) 1237 if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL)
1238 goto err; 1238 goto err;
1239 ret = BN_GF2m_poly2arr(p, arr, max); 1239 ret = BN_GF2m_poly2arr(p, arr, max);
1240 if (!ret || ret > max) { 1240 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)
278 BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); 278 BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
279 return (NULL); 279 return (NULL);
280 } 280 }
281 a = A = reallocarray(NULL, sizeof(BN_ULONG), words); 281 a = A = reallocarray(NULL, words, sizeof(BN_ULONG));
282 if (A == NULL) { 282 if (A == NULL) {
283 BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); 283 BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
284 return (NULL); 284 return (NULL);
diff --git a/src/lib/libcrypto/ec/ec_mult.c b/src/lib/libcrypto/ec/ec_mult.c
index b3bd34d82d..0fd0cab2f1 100644
--- a/src/lib/libcrypto/ec/ec_mult.c
+++ b/src/lib/libcrypto/ec/ec_mult.c
@@ -790,7 +790,7 @@ ec_wNAF_precompute_mult(EC_GROUP * group, BN_CTX * ctx)
790 num = pre_points_per_block * numblocks; /* number of points to 790 num = pre_points_per_block * numblocks; /* number of points to
791 * compute and store */ 791 * compute and store */
792 792
793 points = reallocarray(NULL, sizeof(EC_POINT *), (num + 1)); 793 points = reallocarray(NULL, (num + 1), sizeof(EC_POINT *));
794 if (!points) { 794 if (!points) {
795 ECerr(EC_F_EC_WNAF_PRECOMPUTE_MULT, ERR_R_MALLOC_FAILURE); 795 ECerr(EC_F_EC_WNAF_PRECOMPUTE_MULT, ERR_R_MALLOC_FAILURE);
796 goto err; 796 goto err;
diff --git a/src/lib/libcrypto/lhash/lhash.c b/src/lib/libcrypto/lhash/lhash.c
index e75a43f506..1e3359cfe0 100644
--- a/src/lib/libcrypto/lhash/lhash.c
+++ b/src/lib/libcrypto/lhash/lhash.c
@@ -119,7 +119,7 @@ lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c)
119 119
120 if ((ret = malloc(sizeof(_LHASH))) == NULL) 120 if ((ret = malloc(sizeof(_LHASH))) == NULL)
121 goto err0; 121 goto err0;
122 if ((ret->b = reallocarray(NULL, sizeof(LHASH_NODE *), MIN_NODES)) == NULL) 122 if ((ret->b = reallocarray(NULL, MIN_NODES, sizeof(LHASH_NODE *))) == NULL)
123 goto err1; 123 goto err1;
124 for (i = 0; i < MIN_NODES; i++) 124 for (i = 0; i < MIN_NODES; i++)
125 ret->b[i] = NULL; 125 ret->b[i] = NULL;
diff --git a/src/lib/libcrypto/objects/obj_xref.c b/src/lib/libcrypto/objects/obj_xref.c
index 8e9128efc4..2c1631e773 100644
--- a/src/lib/libcrypto/objects/obj_xref.c
+++ b/src/lib/libcrypto/objects/obj_xref.c
@@ -164,7 +164,7 @@ OBJ_add_sigid(int signid, int dig_id, int pkey_id)
164 sigx_app = sk_nid_triple_new(sigx_cmp); 164 sigx_app = sk_nid_triple_new(sigx_cmp);
165 if (!sigx_app) 165 if (!sigx_app)
166 return 0; 166 return 0;
167 ntr = reallocarray(NULL, sizeof(int), 3); 167 ntr = reallocarray(NULL, 3, sizeof(int));
168 if (!ntr) 168 if (!ntr)
169 return 0; 169 return 0;
170 ntr->sign_id = signid; 170 ntr->sign_id = signid;
diff --git a/src/lib/libcrypto/txt_db/txt_db.c b/src/lib/libcrypto/txt_db/txt_db.c
index 0f3a7ffbb3..e29a60316a 100644
--- a/src/lib/libcrypto/txt_db/txt_db.c
+++ b/src/lib/libcrypto/txt_db/txt_db.c
@@ -94,9 +94,9 @@ TXT_DB_read(BIO *in, int num)
94 ret->qual = NULL; 94 ret->qual = NULL;
95 if ((ret->data = sk_OPENSSL_PSTRING_new_null()) == NULL) 95 if ((ret->data = sk_OPENSSL_PSTRING_new_null()) == NULL)
96 goto err; 96 goto err;
97 if ((ret->index = reallocarray(NULL, sizeof(*ret->index), num)) == NULL) 97 if ((ret->index = reallocarray(NULL, num, sizeof(*ret->index))) == NULL)
98 goto err; 98 goto err;
99 if ((ret->qual = reallocarray(NULL, sizeof(*(ret->qual)), num)) == NULL) 99 if ((ret->qual = reallocarray(NULL, num, sizeof(*(ret->qual)))) == NULL)
100 goto err; 100 goto err;
101 for (i = 0; i < num; i++) { 101 for (i = 0; i < num; i++) {
102 ret->index[i] = NULL; 102 ret->index[i] = NULL;
diff --git a/src/lib/libcrypto/x509v3/pcy_tree.c b/src/lib/libcrypto/x509v3/pcy_tree.c
index 080a87d674..4aa83e027d 100644
--- a/src/lib/libcrypto/x509v3/pcy_tree.c
+++ b/src/lib/libcrypto/x509v3/pcy_tree.c
@@ -220,7 +220,7 @@ tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs, unsigned int flags)
220 return 0; 220 return 0;
221 221
222 tree->flags = 0; 222 tree->flags = 0;
223 tree->levels = reallocarray(NULL, sizeof(X509_POLICY_LEVEL), n); 223 tree->levels = reallocarray(NULL, n, sizeof(X509_POLICY_LEVEL));
224 tree->nlevel = 0; 224 tree->nlevel = 0;
225 tree->extra_data = NULL; 225 tree->extra_data = NULL;
226 tree->auth_policies = NULL; 226 tree->auth_policies = NULL;
diff --git a/src/lib/libssl/src/apps/apps.c b/src/lib/libssl/src/apps/apps.c
index a5ffee3e5f..3b28a6f3cc 100644
--- a/src/lib/libssl/src/apps/apps.c
+++ b/src/lib/libssl/src/apps/apps.c
@@ -214,7 +214,7 @@ chopup_args(ARGS *arg, char *buf, int *argc, char **argv[])
214 i = 0; 214 i = 0;
215 if (arg->count == 0) { 215 if (arg->count == 0) {
216 arg->count = 20; 216 arg->count = 20;
217 arg->data = reallocarray(NULL, sizeof(char *), arg->count); 217 arg->data = reallocarray(NULL, arg->count, sizeof(char *));
218 } 218 }
219 for (i = 0; i < arg->count; i++) 219 for (i = 0; i < arg->count; i++)
220 arg->data[i] = NULL; 220 arg->data[i] = NULL;
diff --git a/src/lib/libssl/src/apps/ca.c b/src/lib/libssl/src/apps/ca.c
index 89c4f84613..bf32446f3b 100644
--- a/src/lib/libssl/src/apps/ca.c
+++ b/src/lib/libssl/src/apps/ca.c
@@ -1974,7 +1974,7 @@ again2:
1974 row[DB_type][0] = 'V'; 1974 row[DB_type][0] = 'V';
1975 row[DB_type][1] = '\0'; 1975 row[DB_type][1] = '\0';
1976 1976
1977 if ((irow = reallocarray(NULL, sizeof(char *), (DB_NUMBER + 1))) == 1977 if ((irow = reallocarray(NULL, DB_NUMBER + 1, sizeof(char *))) ==
1978 NULL) { 1978 NULL) {
1979 BIO_printf(bio_err, "Memory allocation failure\n"); 1979 BIO_printf(bio_err, "Memory allocation failure\n");
1980 goto err; 1980 goto err;
diff --git a/src/lib/libssl/src/apps/ecparam.c b/src/lib/libssl/src/apps/ecparam.c
index 29eaf9ba1a..e5c26c3ad0 100644
--- a/src/lib/libssl/src/apps/ecparam.c
+++ b/src/lib/libssl/src/apps/ecparam.c
@@ -308,7 +308,7 @@ bad:
308 308
309 crv_len = EC_get_builtin_curves(NULL, 0); 309 crv_len = EC_get_builtin_curves(NULL, 0);
310 310
311 curves = reallocarray(NULL, sizeof(EC_builtin_curve), crv_len); 311 curves = reallocarray(NULL, crv_len, sizeof(EC_builtin_curve));
312 312
313 if (curves == NULL) 313 if (curves == NULL)
314 goto end; 314 goto end;
diff --git a/src/lib/libssl/src/crypto/bn/bn_gf2m.c b/src/lib/libssl/src/crypto/bn/bn_gf2m.c
index 4bd50924d3..f451befb0d 100644
--- a/src/lib/libssl/src/crypto/bn/bn_gf2m.c
+++ b/src/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,
547 bn_check_top(a); 547 bn_check_top(a);
548 bn_check_top(b); 548 bn_check_top(b);
549 bn_check_top(p); 549 bn_check_top(p);
550 if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL) 550 if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL)
551 goto err; 551 goto err;
552 ret = BN_GF2m_poly2arr(p, arr, max); 552 ret = BN_GF2m_poly2arr(p, arr, max);
553 if (!ret || ret > max) { 553 if (!ret || ret > max) {
@@ -609,7 +609,7 @@ BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
609 609
610 bn_check_top(a); 610 bn_check_top(a);
611 bn_check_top(p); 611 bn_check_top(p);
612 if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL) 612 if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL)
613 goto err; 613 goto err;
614 ret = BN_GF2m_poly2arr(p, arr, max); 614 ret = BN_GF2m_poly2arr(p, arr, max);
615 if (!ret || ret > max) { 615 if (!ret || ret > max) {
@@ -1037,7 +1037,7 @@ BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p,
1037 bn_check_top(a); 1037 bn_check_top(a);
1038 bn_check_top(b); 1038 bn_check_top(b);
1039 bn_check_top(p); 1039 bn_check_top(p);
1040 if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL) 1040 if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL)
1041 goto err; 1041 goto err;
1042 ret = BN_GF2m_poly2arr(p, arr, max); 1042 ret = BN_GF2m_poly2arr(p, arr, max);
1043 if (!ret || ret > max) { 1043 if (!ret || ret > max) {
@@ -1099,7 +1099,7 @@ BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
1099 int *arr = NULL; 1099 int *arr = NULL;
1100 bn_check_top(a); 1100 bn_check_top(a);
1101 bn_check_top(p); 1101 bn_check_top(p);
1102 if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL) 1102 if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL)
1103 goto err; 1103 goto err;
1104 ret = BN_GF2m_poly2arr(p, arr, max); 1104 ret = BN_GF2m_poly2arr(p, arr, max);
1105 if (!ret || ret > max) { 1105 if (!ret || ret > max) {
@@ -1234,7 +1234,7 @@ BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
1234 1234
1235 bn_check_top(a); 1235 bn_check_top(a);
1236 bn_check_top(p); 1236 bn_check_top(p);
1237 if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL) 1237 if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL)
1238 goto err; 1238 goto err;
1239 ret = BN_GF2m_poly2arr(p, arr, max); 1239 ret = BN_GF2m_poly2arr(p, arr, max);
1240 if (!ret || ret > max) { 1240 if (!ret || ret > max) {
diff --git a/src/lib/libssl/src/crypto/bn/bn_lib.c b/src/lib/libssl/src/crypto/bn/bn_lib.c
index 28489f8181..a4f0bdd34b 100644
--- a/src/lib/libssl/src/crypto/bn/bn_lib.c
+++ b/src/lib/libssl/src/crypto/bn/bn_lib.c
@@ -278,7 +278,7 @@ bn_expand_internal(const BIGNUM *b, int words)
278 BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); 278 BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
279 return (NULL); 279 return (NULL);
280 } 280 }
281 a = A = reallocarray(NULL, sizeof(BN_ULONG), words); 281 a = A = reallocarray(NULL, words, sizeof(BN_ULONG));
282 if (A == NULL) { 282 if (A == NULL) {
283 BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); 283 BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
284 return (NULL); 284 return (NULL);
diff --git a/src/lib/libssl/src/crypto/ec/ec_mult.c b/src/lib/libssl/src/crypto/ec/ec_mult.c
index b3bd34d82d..0fd0cab2f1 100644
--- a/src/lib/libssl/src/crypto/ec/ec_mult.c
+++ b/src/lib/libssl/src/crypto/ec/ec_mult.c
@@ -790,7 +790,7 @@ ec_wNAF_precompute_mult(EC_GROUP * group, BN_CTX * ctx)
790 num = pre_points_per_block * numblocks; /* number of points to 790 num = pre_points_per_block * numblocks; /* number of points to
791 * compute and store */ 791 * compute and store */
792 792
793 points = reallocarray(NULL, sizeof(EC_POINT *), (num + 1)); 793 points = reallocarray(NULL, (num + 1), sizeof(EC_POINT *));
794 if (!points) { 794 if (!points) {
795 ECerr(EC_F_EC_WNAF_PRECOMPUTE_MULT, ERR_R_MALLOC_FAILURE); 795 ECerr(EC_F_EC_WNAF_PRECOMPUTE_MULT, ERR_R_MALLOC_FAILURE);
796 goto err; 796 goto err;
diff --git a/src/lib/libssl/src/crypto/lhash/lhash.c b/src/lib/libssl/src/crypto/lhash/lhash.c
index e75a43f506..1e3359cfe0 100644
--- a/src/lib/libssl/src/crypto/lhash/lhash.c
+++ b/src/lib/libssl/src/crypto/lhash/lhash.c
@@ -119,7 +119,7 @@ lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c)
119 119
120 if ((ret = malloc(sizeof(_LHASH))) == NULL) 120 if ((ret = malloc(sizeof(_LHASH))) == NULL)
121 goto err0; 121 goto err0;
122 if ((ret->b = reallocarray(NULL, sizeof(LHASH_NODE *), MIN_NODES)) == NULL) 122 if ((ret->b = reallocarray(NULL, MIN_NODES, sizeof(LHASH_NODE *))) == NULL)
123 goto err1; 123 goto err1;
124 for (i = 0; i < MIN_NODES; i++) 124 for (i = 0; i < MIN_NODES; i++)
125 ret->b[i] = NULL; 125 ret->b[i] = NULL;
diff --git a/src/lib/libssl/src/crypto/objects/obj_xref.c b/src/lib/libssl/src/crypto/objects/obj_xref.c
index 8e9128efc4..2c1631e773 100644
--- a/src/lib/libssl/src/crypto/objects/obj_xref.c
+++ b/src/lib/libssl/src/crypto/objects/obj_xref.c
@@ -164,7 +164,7 @@ OBJ_add_sigid(int signid, int dig_id, int pkey_id)
164 sigx_app = sk_nid_triple_new(sigx_cmp); 164 sigx_app = sk_nid_triple_new(sigx_cmp);
165 if (!sigx_app) 165 if (!sigx_app)
166 return 0; 166 return 0;
167 ntr = reallocarray(NULL, sizeof(int), 3); 167 ntr = reallocarray(NULL, 3, sizeof(int));
168 if (!ntr) 168 if (!ntr)
169 return 0; 169 return 0;
170 ntr->sign_id = signid; 170 ntr->sign_id = signid;
diff --git a/src/lib/libssl/src/crypto/txt_db/txt_db.c b/src/lib/libssl/src/crypto/txt_db/txt_db.c
index 0f3a7ffbb3..e29a60316a 100644
--- a/src/lib/libssl/src/crypto/txt_db/txt_db.c
+++ b/src/lib/libssl/src/crypto/txt_db/txt_db.c
@@ -94,9 +94,9 @@ TXT_DB_read(BIO *in, int num)
94 ret->qual = NULL; 94 ret->qual = NULL;
95 if ((ret->data = sk_OPENSSL_PSTRING_new_null()) == NULL) 95 if ((ret->data = sk_OPENSSL_PSTRING_new_null()) == NULL)
96 goto err; 96 goto err;
97 if ((ret->index = reallocarray(NULL, sizeof(*ret->index), num)) == NULL) 97 if ((ret->index = reallocarray(NULL, num, sizeof(*ret->index))) == NULL)
98 goto err; 98 goto err;
99 if ((ret->qual = reallocarray(NULL, sizeof(*(ret->qual)), num)) == NULL) 99 if ((ret->qual = reallocarray(NULL, num, sizeof(*(ret->qual)))) == NULL)
100 goto err; 100 goto err;
101 for (i = 0; i < num; i++) { 101 for (i = 0; i < num; i++) {
102 ret->index[i] = NULL; 102 ret->index[i] = NULL;
diff --git a/src/lib/libssl/src/crypto/x509v3/pcy_tree.c b/src/lib/libssl/src/crypto/x509v3/pcy_tree.c
index 080a87d674..4aa83e027d 100644
--- a/src/lib/libssl/src/crypto/x509v3/pcy_tree.c
+++ b/src/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)
220 return 0; 220 return 0;
221 221
222 tree->flags = 0; 222 tree->flags = 0;
223 tree->levels = reallocarray(NULL, sizeof(X509_POLICY_LEVEL), n); 223 tree->levels = reallocarray(NULL, n, sizeof(X509_POLICY_LEVEL));
224 tree->nlevel = 0; 224 tree->nlevel = 0;
225 tree->extra_data = NULL; 225 tree->extra_data = NULL;
226 tree->auth_policies = NULL; 226 tree->auth_policies = NULL;