diff options
| author | beck <> | 2019-03-23 18:48:15 +0000 |
|---|---|---|
| committer | beck <> | 2019-03-23 18:48:15 +0000 |
| commit | c7b9ffc836ad7a05586d7c83c368d784af9cacda (patch) | |
| tree | 5a672c6d12222c102b5aef132ff6174f5fec66f9 /src/lib/libcrypto/bn/bn_lib.c | |
| parent | b45cb195c7a0d58f9ee417f6a2035faec7d3a555 (diff) | |
| download | openbsd-c7b9ffc836ad7a05586d7c83c368d784af9cacda.tar.gz openbsd-c7b9ffc836ad7a05586d7c83c368d784af9cacda.tar.bz2 openbsd-c7b9ffc836ad7a05586d7c83c368d784af9cacda.zip | |
Add range checks to varios ASN1_INTEGER functions to ensure the
sizes used remain a positive integer. Should address issue
13799 from oss-fuzz
ok tb@ jsing@
Diffstat (limited to 'src/lib/libcrypto/bn/bn_lib.c')
| -rw-r--r-- | src/lib/libcrypto/bn/bn_lib.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index 0b79a87413..0025cf52ef 100644 --- a/src/lib/libcrypto/bn/bn_lib.c +++ b/src/lib/libcrypto/bn/bn_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_lib.c,v 1.45 2018/07/23 18:14:32 tb Exp $ */ | 1 | /* $OpenBSD: bn_lib.c,v 1.46 2019/03/23 18:48:15 beck 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 | * |
| @@ -578,6 +578,8 @@ BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) | |||
| 578 | BN_ULONG l; | 578 | BN_ULONG l; |
| 579 | BIGNUM *bn = NULL; | 579 | BIGNUM *bn = NULL; |
| 580 | 580 | ||
| 581 | if (len < 0) | ||
| 582 | return (NULL); | ||
| 581 | if (ret == NULL) | 583 | if (ret == NULL) |
| 582 | ret = bn = BN_new(); | 584 | ret = bn = BN_new(); |
| 583 | if (ret == NULL) | 585 | if (ret == NULL) |
