Avoid signed integer overflow in i2c_ASN1_BIT_STRING()
authortb <tb@openbsd.org>
Tue, 8 Nov 2022 16:48:28 +0000 (16:48 +0000)
committertb <tb@openbsd.org>
Tue, 8 Nov 2022 16:48:28 +0000 (16:48 +0000)
commitf81cc285d2aed8b36615119a306533696f3eb66c
tree5dd567e422c851726b0826d71677f1f21cb10ef2
parent5f17b30aee8b388e13101395f1f026cb3b5be4a6
Avoid signed integer overflow in i2c_ASN1_BIT_STRING()

If the length of the bitstring is INT_MAX, adding 1 to it is undefined
behavior, so error out before doing so.

Based on BoringSSL eeb3333f by davidben

ok beck joshua
lib/libcrypto/asn1/a_bitstr.c