diff options
| author | deraadt <> | 2014-05-29 21:07:43 +0000 |
|---|---|---|
| committer | deraadt <> | 2014-05-29 21:07:43 +0000 |
| commit | 642d45ae22413aa8195b105d051ca8896e782c5d (patch) | |
| tree | d5fe0c330801f3e72c7b588264c6027636db4330 /src/lib/libcrypto/bn/bn_ctx.c | |
| parent | f60b3b3365842d8869513a7e36981671cd726939 (diff) | |
| download | openbsd-642d45ae22413aa8195b105d051ca8896e782c5d.tar.gz openbsd-642d45ae22413aa8195b105d051ca8896e782c5d.tar.bz2 openbsd-642d45ae22413aa8195b105d051ca8896e782c5d.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/bn/bn_ctx.c')
| -rw-r--r-- | src/lib/libcrypto/bn/bn_ctx.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libcrypto/bn/bn_ctx.c b/src/lib/libcrypto/bn/bn_ctx.c index 7407dade50..2368e25183 100644 --- a/src/lib/libcrypto/bn/bn_ctx.c +++ b/src/lib/libcrypto/bn/bn_ctx.c | |||
| @@ -349,8 +349,8 @@ BN_STACK_push(BN_STACK *st, unsigned int idx) | |||
| 349 | { | 349 | { |
| 350 | unsigned int newsize = (st->size ? | 350 | unsigned int newsize = (st->size ? |
| 351 | (st->size * 3 / 2) : BN_CTX_START_FRAMES); | 351 | (st->size * 3 / 2) : BN_CTX_START_FRAMES); |
| 352 | unsigned int *newitems = malloc(newsize * | 352 | unsigned int *newitems = reallocarray(NULL, |
| 353 | sizeof(unsigned int)); | 353 | newsize, sizeof(unsigned int)); |
| 354 | if (!newitems) | 354 | if (!newitems) |
| 355 | return 0; | 355 | return 0; |
| 356 | if (st->depth) | 356 | if (st->depth) |
