Skip to content

Commit

Permalink
Add check for xor_get_aid()
Browse files Browse the repository at this point in the history
Add check for the return value of xor_get_aid() in order to avoid NULL pointer deference.

For example, "algor" could be NULL if the allocation of X509_ALGOR_new() fails. As a result, i2d_X509_ALGOR() will return 0 and "ctx->aid" will be an invalid value NULL.

Fixes: f4ed6ee ("SSL_set1_groups_list(): Fix memory corruption with 40 groups and more")
Signed-off-by: Jiasheng Jiang <jiasheng@purdue.edu>

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #23764)

(cherry picked from commit bc930be)
  • Loading branch information
JiangJias authored and t8m committed Mar 12, 2024
1 parent 3edd0c1 commit c85827b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/tls-provider.c
Original file line number Diff line number Diff line change
Expand Up @@ -2691,6 +2691,10 @@ static int xor_sig_setup_md(PROV_XORSIG_CTX *ctx,
OPENSSL_free(ctx->aid);
ctx->aid = NULL;
ctx->aid_len = xor_get_aid(&(ctx->aid), ctx->sig->tls_name);
if (ctx->aid_len <= 0) {
EVP_MD_free(md);
return 0;
}

ctx->mdctx = NULL;
ctx->md = md;
Expand Down

0 comments on commit c85827b

Please sign in to comment.