From: xkernel Date: Tue, 18 Oct 2022 16:54:26 +0000 (+0800) Subject: add a check for the return of sk_SRP_gN_new_null() so that capture the potential... X-Git-Tag: openssl-3.2.0-alpha1~1891 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f44d32fdfbd2a249dae74dc24478f31fca69d288;p=thirdparty%2Fopenssl.git add a check for the return of sk_SRP_gN_new_null() so that capture the potential memory error in time Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/19435) --- diff --git a/crypto/srp/srp_vfy.c b/crypto/srp/srp_vfy.c index b490845e22f..72ef5e814e6 100644 --- a/crypto/srp/srp_vfy.c +++ b/crypto/srp/srp_vfy.c @@ -391,7 +391,7 @@ static BIGNUM *SRP_gN_place_bn(STACK_OF(SRP_gN_cache) *gN_cache, char *ch) int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file) { - int error_code; + int error_code = SRP_ERR_MEMORY; STACK_OF(SRP_gN) *SRP_gN_tab = sk_SRP_gN_new_null(); char *last_index = NULL; int i; @@ -403,6 +403,9 @@ int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file) TXT_DB *tmpdb = NULL; BIO *in = BIO_new(BIO_s_file()); + if (SRP_gN_tab == NULL) + goto err; + error_code = SRP_ERR_OPEN_FILE; if (in == NULL || BIO_read_filename(in, verifier_file) <= 0)