check i2d_ASN1_TYPE return value
authorbonniegong <46280630+bonniegong@users.noreply.github.com>
Mon, 12 Apr 2021 02:43:13 +0000 (10:43 +0800)
committerPauli <pauli@openssl.org>
Fri, 14 May 2021 00:14:53 +0000 (10:14 +1000)
commita812f8fc8f3c9ba30e5ecd2c168cca0613f15dcd
tree93ce1ede8937f06d3998962b2d8d6b0f9392626d
parent9a48d4a4fec6827d387ee63756504892e3656299
check i2d_ASN1_TYPE return value

add a length check to the return value of function i2d_ASN1_TYPE. Return an error instead of trying to malloc a negative number.

CLA: trivial

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14828)

(cherry picked from commit c65abf2213117eb5348a46fbc18f706aca052e85)
crypto/asn1/a_strex.c