summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorderaadt <>2014-05-29 21:42:44 +0000
committerderaadt <>2014-05-29 21:42:44 +0000
commit4089f5fc0965b7893c718c54c03be24eb1edd2a0 (patch)
tree7efe3e7394ad0a0d226925d3a9fb5501c42e6e2c
parentdae420d61681237e116739a2ef3eab736c4d0861 (diff)
downloadopenbsd-4089f5fc0965b7893c718c54c03be24eb1edd2a0.tar.gz
openbsd-4089f5fc0965b7893c718c54c03be24eb1edd2a0.tar.bz2
openbsd-4089f5fc0965b7893c718c54c03be24eb1edd2a0.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
-rw-r--r--src/lib/libcrypto/lhash/lhash.c6
-rw-r--r--src/lib/libssl/src/crypto/lhash/lhash.c6
2 files changed, 4 insertions, 8 deletions
diff --git a/src/lib/libcrypto/lhash/lhash.c b/src/lib/libcrypto/lhash/lhash.c
index 1e3359cfe0..932391fa1e 100644
--- a/src/lib/libcrypto/lhash/lhash.c
+++ b/src/lib/libcrypto/lhash/lhash.c
@@ -337,8 +337,7 @@ expand(_LHASH *lh)
337 337
338 if ((lh->p) >= lh->pmax) { 338 if ((lh->p) >= lh->pmax) {
339 j = (int)lh->num_alloc_nodes * 2; 339 j = (int)lh->num_alloc_nodes * 2;
340 n = (LHASH_NODE **)realloc(lh->b, 340 n = reallocarray(lh->b, j, sizeof(LHASH_NODE *));
341 (int)(sizeof(LHASH_NODE *) * j));
342 if (n == NULL) { 341 if (n == NULL) {
343/* fputs("realloc error in lhash", stderr); */ 342/* fputs("realloc error in lhash", stderr); */
344 lh->error++; 343 lh->error++;
@@ -364,8 +363,7 @@ contract(_LHASH *lh)
364 np = lh->b[lh->p + lh->pmax - 1]; 363 np = lh->b[lh->p + lh->pmax - 1];
365 lh->b[lh->p+lh->pmax - 1] = NULL; /* 24/07-92 - eay - weird but :-( */ 364 lh->b[lh->p+lh->pmax - 1] = NULL; /* 24/07-92 - eay - weird but :-( */
366 if (lh->p == 0) { 365 if (lh->p == 0) {
367 n = (LHASH_NODE **)realloc(lh->b, 366 n = reallocarray(lh->b, lh->pmax, sizeof(LHASH_NODE *));
368 (unsigned int)(sizeof(LHASH_NODE *) * lh->pmax));
369 if (n == NULL) { 367 if (n == NULL) {
370/* fputs("realloc error in lhash", stderr); */ 368/* fputs("realloc error in lhash", stderr); */
371 lh->error++; 369 lh->error++;
diff --git a/src/lib/libssl/src/crypto/lhash/lhash.c b/src/lib/libssl/src/crypto/lhash/lhash.c
index 1e3359cfe0..932391fa1e 100644
--- a/src/lib/libssl/src/crypto/lhash/lhash.c
+++ b/src/lib/libssl/src/crypto/lhash/lhash.c
@@ -337,8 +337,7 @@ expand(_LHASH *lh)
337 337
338 if ((lh->p) >= lh->pmax) { 338 if ((lh->p) >= lh->pmax) {
339 j = (int)lh->num_alloc_nodes * 2; 339 j = (int)lh->num_alloc_nodes * 2;
340 n = (LHASH_NODE **)realloc(lh->b, 340 n = reallocarray(lh->b, j, sizeof(LHASH_NODE *));
341 (int)(sizeof(LHASH_NODE *) * j));
342 if (n == NULL) { 341 if (n == NULL) {
343/* fputs("realloc error in lhash", stderr); */ 342/* fputs("realloc error in lhash", stderr); */
344 lh->error++; 343 lh->error++;
@@ -364,8 +363,7 @@ contract(_LHASH *lh)
364 np = lh->b[lh->p + lh->pmax - 1]; 363 np = lh->b[lh->p + lh->pmax - 1];
365 lh->b[lh->p+lh->pmax - 1] = NULL; /* 24/07-92 - eay - weird but :-( */ 364 lh->b[lh->p+lh->pmax - 1] = NULL; /* 24/07-92 - eay - weird but :-( */
366 if (lh->p == 0) { 365 if (lh->p == 0) {
367 n = (LHASH_NODE **)realloc(lh->b, 366 n = reallocarray(lh->b, lh->pmax, sizeof(LHASH_NODE *));
368 (unsigned int)(sizeof(LHASH_NODE *) * lh->pmax));
369 if (n == NULL) { 367 if (n == NULL) {
370/* fputs("realloc error in lhash", stderr); */ 368/* fputs("realloc error in lhash", stderr); */
371 lh->error++; 369 lh->error++;