Skip to content

Commit

Permalink
Add static check in BN_hex2bn
Browse files Browse the repository at this point in the history
Fixes openssl#17298

Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: Paul Dale <[email protected]>
(Merged from openssl#17299)
  • Loading branch information
KanPlus authored and paulidale committed Dec 23, 2021
1 parent a595e32 commit 7c78bd4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crypto/bn/bn_conv.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ int BN_hex2bn(BIGNUM **bn, const char *a)
return 0;
} else {
ret = *bn;
if (BN_get_flags(ret, BN_FLG_STATIC_DATA)) {
ERR_raise(ERR_LIB_BN, ERR_R_PASSED_INVALID_ARGUMENT);
return 0;
}
BN_zero(ret);
}

Expand Down

0 comments on commit 7c78bd4

Please sign in to comment.