summaryrefslogtreecommitdiffstats
path: root/lib/libcrypto
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2014-05-29 21:42:44 +0000
committerderaadt <deraadt@openbsd.org>2014-05-29 21:42:44 +0000
commit499d5dd428e83f8088c1cbb4fe8113163111d75c (patch)
tree700a9d82c7f724d004e472487ce601bb9e9113b1 /lib/libcrypto
parenttrivial realloc -> reallocarray (diff)
downloadwireguard-openbsd-499d5dd428e83f8088c1cbb4fe8113163111d75c.tar.xz
wireguard-openbsd-499d5dd428e83f8088c1cbb4fe8113163111d75c.zip
I do not have time to describe how bad the realloc() uses in here, now
being relaced by reallocarray(). you will have to look at the diff. there can be no explanations for the extra casts. as beck says, "Don't go towards the light theo!" ok beck tedu
Diffstat (limited to 'lib/libcrypto')
-rw-r--r--lib/libcrypto/lhash/lhash.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/libcrypto/lhash/lhash.c b/lib/libcrypto/lhash/lhash.c
index 1e3359cfe06..932391fa1e6 100644
--- a/lib/libcrypto/lhash/lhash.c
+++ b/lib/libcrypto/lhash/lhash.c
@@ -337,8 +337,7 @@ expand(_LHASH *lh)
if ((lh->p) >= lh->pmax) {
j = (int)lh->num_alloc_nodes * 2;
- n = (LHASH_NODE **)realloc(lh->b,
- (int)(sizeof(LHASH_NODE *) * j));
+ n = reallocarray(lh->b, j, sizeof(LHASH_NODE *));
if (n == NULL) {
/* fputs("realloc error in lhash", stderr); */
lh->error++;
@@ -364,8 +363,7 @@ contract(_LHASH *lh)
np = lh->b[lh->p + lh->pmax - 1];
lh->b[lh->p+lh->pmax - 1] = NULL; /* 24/07-92 - eay - weird but :-( */
if (lh->p == 0) {
- n = (LHASH_NODE **)realloc(lh->b,
- (unsigned int)(sizeof(LHASH_NODE *) * lh->pmax));
+ n = reallocarray(lh->b, lh->pmax, sizeof(LHASH_NODE *));
if (n == NULL) {
/* fputs("realloc error in lhash", stderr); */
lh->error++;