From cba024dc685d13dbcbd0577bed028ee6b295b56a Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Sat, 11 Aug 2018 09:59:20 +0200 Subject: i2d_ASN1_OBJECT(): allocate memory if the user didn't provide a buffer Since 0.9.7, all i2d_ functions were documented to allocate an output buffer if the user didn't provide one, under these conditions (from the 1.0.2 documentation): For OpenSSL 0.9.7 and later if B<*out> is B memory will be allocated for a buffer and the encoded data written to it. In this case B<*out> is not incremented and it points to the start of the data just written. i2d_ASN1_OBJECT was found not to do this, and would crash if a NULL output buffer was provided. Fixes #6914 Reviewed-by: Matthias St. Pierre (Merged from https://github.com/openssl/openssl/pull/6918) --- include/openssl/asn1err.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/openssl/asn1err.h b/include/openssl/asn1err.h index 8001120..5a91126 100644 --- a/include/openssl/asn1err.h +++ b/include/openssl/asn1err.h @@ -101,6 +101,7 @@ int ERR_load_ASN1_strings(void); # define ASN1_F_DO_TCREATE 222 # define ASN1_F_I2A_ASN1_OBJECT 126 # define ASN1_F_I2D_ASN1_BIO_STREAM 211 +# define ASN1_F_I2D_ASN1_OBJECT 143 # define ASN1_F_I2D_DSA_PUBKEY 161 # define ASN1_F_I2D_EC_PUBKEY 181 # define ASN1_F_I2D_PRIVATEKEY 163 -- cgit v1.1