diff options
author | deraadt <> | 2014-05-29 21:07:43 +0000 |
---|---|---|
committer | deraadt <> | 2014-05-29 21:07:43 +0000 |
commit | 3d662abca6b2a7f5bc9108b036434d61fcdb6e53 (patch) | |
tree | d5fe0c330801f3e72c7b588264c6027636db4330 /src/lib/libcrypto/lhash | |
parent | d205a2aecb99564cccfbea61c39ebe3b0ddd7fb7 (diff) | |
download | openbsd-3d662abca6b2a7f5bc9108b036434d61fcdb6e53.tar.gz openbsd-3d662abca6b2a7f5bc9108b036434d61fcdb6e53.tar.bz2 openbsd-3d662abca6b2a7f5bc9108b036434d61fcdb6e53.zip |
convert 53 malloc(a*b) to reallocarray(NULL, a, b). that is 53
potential integer overflows easily changed into an allocation return
of NULL, with errno nicely set if need be. checks for an allocations
returning NULL are commonplace, or if the object is dereferenced
(quite normal) will result in a nice fault which can be detected &
repaired properly.
ok tedu
Diffstat (limited to 'src/lib/libcrypto/lhash')
-rw-r--r-- | src/lib/libcrypto/lhash/lhash.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/libcrypto/lhash/lhash.c b/src/lib/libcrypto/lhash/lhash.c index ad24a7726b..e75a43f506 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 = malloc(sizeof(LHASH_NODE *) * MIN_NODES)) == NULL) | 122 | if ((ret->b = reallocarray(NULL, sizeof(LHASH_NODE *), MIN_NODES)) == 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; |