summaryrefslogtreecommitdiff
path: root/crypto/bn/bn_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/bn/bn_lib.c')
-rw-r--r--crypto/bn/bn_lib.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c
index 9d665c26fc..ead513c7ae 100644
--- a/crypto/bn/bn_lib.c
+++ b/crypto/bn/bn_lib.c
@@ -440,6 +440,10 @@ static BIGNUM *bin2bn(const unsigned char *s, int len, BIGNUM *ret,
unsigned int n;
BIGNUM *bn = NULL;
+ /* Negative length is not acceptable */
+ if (len < 0)
+ return NULL;
+
if (ret == NULL)
ret = bn = BN_new();
if (ret == NULL)