From: huangqinjin Date: Fri, 6 May 2016 16:50:22 +0000 (+0800) Subject: fix BN_hex2bn()/BN_dec2bn() memory leak X-Git-Tag: OpenSSL_1_1_0-pre6~691 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=58c03e3b9225fe1a8e3f6b8c23c45b33e26fedb5;p=oweals%2Fopenssl.git fix BN_hex2bn()/BN_dec2bn() memory leak Reviewed-by: Kurt Roeckx Reviewed-by: Matt Caswell --- diff --git a/crypto/bn/bn_print.c b/crypto/bn/bn_print.c index 8d06405ab6..78589dba5b 100644 --- a/crypto/bn/bn_print.c +++ b/crypto/bn/bn_print.c @@ -139,7 +139,7 @@ int BN_hex2bn(BIGNUM **bn, const char *a) for (i = 0; i <= (INT_MAX/4) && isxdigit((unsigned char)a[i]); i++) continue; - if (i > INT_MAX/4) + if (i == 0 || i > INT_MAX/4) goto err; num = i + neg; @@ -209,7 +209,7 @@ int BN_dec2bn(BIGNUM **bn, const char *a) for (i = 0; i <= (INT_MAX/4) && isdigit((unsigned char)a[i]); i++) continue; - if (i > INT_MAX/4) + if (i == 0 || i > INT_MAX/4) goto err; num = i + neg;