diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/bn/bn_rand.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bn/bn_rand.c b/src/lib/libcrypto/bn/bn_rand.c index a5b163c820..9cfcd8e2c0 100644 --- a/src/lib/libcrypto/bn/bn_rand.c +++ b/src/lib/libcrypto/bn/bn_rand.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_rand.c,v 1.29 2023/08/03 18:53:55 tb Exp $ */ | 1 | /* $OpenBSD: bn_rand.c,v 1.30 2024/03/16 20:42:33 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -109,6 +109,7 @@ | |||
| 109 | * | 109 | * |
| 110 | */ | 110 | */ |
| 111 | 111 | ||
| 112 | #include <limits.h> | ||
| 112 | #include <stdio.h> | 113 | #include <stdio.h> |
| 113 | #include <stdlib.h> | 114 | #include <stdlib.h> |
| 114 | #include <string.h> | 115 | #include <string.h> |
| @@ -133,6 +134,10 @@ bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) | |||
| 133 | BNerror(BN_R_BITS_TOO_SMALL); | 134 | BNerror(BN_R_BITS_TOO_SMALL); |
| 134 | return (0); | 135 | return (0); |
| 135 | } | 136 | } |
| 137 | if (bits > INT_MAX - 7) { | ||
| 138 | BNerror(BN_R_BIGNUM_TOO_LONG); | ||
| 139 | return (0); | ||
| 140 | } | ||
| 136 | 141 | ||
| 137 | if (bits == 0) { | 142 | if (bits == 0) { |
| 138 | BN_zero(rnd); | 143 | BN_zero(rnd); |
