Skip to content

Commit

Permalink
add a check for the return of sk_SRP_gN_new_null() so that capture th…
Browse files Browse the repository at this point in the history
…e potential memory error in time

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from #19435)
  • Loading branch information
x2018 authored and paulidale committed Oct 20, 2022
1 parent fdc5043 commit f44d32f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crypto/srp/srp_vfy.c
Expand Up @@ -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;
Expand All @@ -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)
Expand Down

0 comments on commit f44d32f

Please sign in to comment.