summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/o_init.c
diff options
context:
space:
mode:
authortb <>2024-03-16 20:42:33 +0000
committertb <>2024-03-16 20:42:33 +0000
commit68bc09a557a7892bbe063a0dca7bf5b29969d17b (patch)
treeafec26b3eec5a25b6b736b2fa67ee5af9d9d75b6 /src/lib/libcrypto/o_init.c
parent171db56525fb141b1eec2ce5711800d195aa1d8f (diff)
downloadopenbsd-68bc09a557a7892bbe063a0dca7bf5b29969d17b.tar.gz
openbsd-68bc09a557a7892bbe063a0dca7bf5b29969d17b.tar.bz2
openbsd-68bc09a557a7892bbe063a0dca7bf5b29969d17b.zip
Fix signed integer overflow in bnrand()
If more bits than INT_MAX - 7 are requested, the calculation of number of bytes required to store the bignum triggers undefined behavior due to signed integer overflow. This will typically result in bytes becoming negative which will then make malloc() fail. If the ulimit should be high enough to make malloc() succeed, there is a bad out of bounds write in case bottom is set (an odd number was requested). On jsing's request this does not deal with another bug which we could catch with a similar check due to BN_bn2bin() failing later on as the number of words in a BIGNUM is some fraction of INT_MAX. ok jsing
Diffstat (limited to 'src/lib/libcrypto/o_init.c')
0 files changed, 0 insertions, 0 deletions