summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2014-05-29 21:42:45 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2014-05-29 21:42:45 +0000
commitaf1afaf236c6d0745e382297f4b6c8c667be47fc (patch)
tree33455b248bbb84338e195c69971f1283d7ae7706 /lib
parent18abd83e38528339a45bdc2ecb562aed2b91d6df (diff)
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')
-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++;