diff options
Diffstat (limited to 'src/lib/libcrypto/bn/bn_lib.c')
-rw-r--r-- | src/lib/libcrypto/bn/bn_lib.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index b6b0ce4b3c..7767d65170 100644 --- a/src/lib/libcrypto/bn/bn_lib.c +++ b/src/lib/libcrypto/bn/bn_lib.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #endif | 62 | #endif |
63 | 63 | ||
64 | #include <assert.h> | 64 | #include <assert.h> |
65 | #include <limits.h> | ||
65 | #include <stdio.h> | 66 | #include <stdio.h> |
66 | #include "cryptlib.h" | 67 | #include "cryptlib.h" |
67 | #include "bn_lcl.h" | 68 | #include "bn_lcl.h" |
@@ -319,6 +320,12 @@ BIGNUM *bn_expand2(BIGNUM *b, int words) | |||
319 | 320 | ||
320 | if (words > b->dmax) | 321 | if (words > b->dmax) |
321 | { | 322 | { |
323 | if (words > (INT_MAX/(4*BN_BITS2))) | ||
324 | { | ||
325 | BNerr(BN_F_BN_EXPAND2,BN_R_BIGNUM_TOO_LONG); | ||
326 | return NULL; | ||
327 | } | ||
328 | |||
322 | bn_check_top(b); | 329 | bn_check_top(b); |
323 | if (BN_get_flags(b,BN_FLG_STATIC_DATA)) | 330 | if (BN_get_flags(b,BN_FLG_STATIC_DATA)) |
324 | { | 331 | { |