openssl/crypto/asn1
Bernd Edlinger d550d2aae5 Fix unpredictible refcount handling of d2i functions
The passed in reference of a ref-counted object
is free'd by d2i functions in the error handling.
However if it is not the last reference, the
in/out reference variable is not set to null here.
This makes it impossible for the caller to handle
the error correctly, because there are numerous
cases where the passed in reference is free'd
and set to null, while in other cases, where the
passed in reference is not free'd, the reference
is left untouched.

Therefore the passed in reference must be set
to NULL even when it was not the last reference.

Fixes #23713

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22809)
2024-08-16 10:07:52 +02:00
..
a_bitstr.c Copyright year updates 2023-09-07 09:59:15 +01:00
a_d2i_fp.c Allow short reads in asn1_d2i_read_bio() 2024-07-18 19:05:46 +02:00
a_digest.c Stop raising ERR_R_MALLOC_FAILURE in most places 2022-10-05 14:02:03 +02:00
a_dup.c Stop raising ERR_R_MALLOC_FAILURE in most places 2022-10-05 14:02:03 +02:00
a_gentm.c Update copyright year 2021-04-08 13:04:41 +01:00
a_i2d_fp.c Stop raising ERR_R_MALLOC_FAILURE in most places 2022-10-05 14:02:03 +02:00
a_int.c Stop raising ERR_R_MALLOC_FAILURE in most places 2022-10-05 14:02:03 +02:00
a_mbstr.c Fix error handling in ASN1_mbstring_ncopy 2023-12-29 10:23:29 +01:00
a_object.c Fix Coverity-1604641 2024-07-25 14:23:39 -04:00
a_octet.c
a_print.c Update copyright year 2021-09-07 13:35:43 +02:00
a_sign.c Stop raising ERR_R_MALLOC_FAILURE in most places 2022-10-05 14:02:03 +02:00
a_strex.c do_print_ex(): Avoid possible integer overflow 2024-08-07 19:39:26 +02:00
a_strnid.c Copyright year updates 2023-09-07 09:59:15 +01:00
a_time.c Move ossl_asn1_string_to_time_t() to libtestutil 2024-05-07 12:07:49 +02:00
a_type.c Update copyright year 2021-04-08 13:04:41 +01:00
a_utctm.c Update copyright year 2021-04-08 13:04:41 +01:00
a_utf8.c ASN1: limit the Unicode code point range in UTF8_getc() and UTF8_putc() 2021-03-18 14:12:48 +10:00
a_verify.c ASN1_item_verify_ctx(): Return -1 on fatal errors 2024-06-21 10:03:42 +02:00
ameth_lib.c Stop raising ERR_R_MALLOC_FAILURE in most places 2022-10-05 14:02:03 +02:00
asn1_err.c Copyright year updates 2024-04-09 13:43:26 +02:00
asn1_gen.c Do not include crypto/asn1.h from internal/cryptlib.h 2023-10-19 10:15:56 +02:00
asn1_item_list.c Add RFC 5755 attribute certificate support 2024-04-24 14:05:32 +01:00
asn1_item_list.h Add RFC 5755 attribute certificate support 2024-04-24 14:05:32 +01:00
asn1_lib.c Stop raising ERR_R_MALLOC_FAILURE in most places 2022-10-05 14:02:03 +02:00
asn1_local.h libcrypto refactoring: introduce and use ossl_asn1_string_set_bits_left() 2022-07-19 08:44:19 +02:00
asn1_parse.c Copyright year updates 2023-09-07 09:59:15 +01:00
asn_mime.c Copyright year updates 2023-09-07 09:59:15 +01:00
asn_moid.c Harden asn1 oid loader to invalid inputs 2023-12-13 11:10:36 -05:00
asn_mstbl.c Copyright year updates 2024-04-09 13:43:26 +02:00
asn_pack.c Copyright year updates 2023-09-07 09:59:15 +01:00
bio_asn1.c Fix BIO_f_asn1() to properly report some errors 2022-12-22 11:01:06 +01:00
bio_ndef.c Copyright year updates 2023-09-07 09:59:15 +01:00
build.info ASN1: rename asn1_par.c to asn1_parse.c for clarity; simplify asn1_parse2() 2021-06-15 14:23:21 +02:00
charmap.h Fix copyright year issues 2022-01-06 09:27:02 +01:00
charmap.pl Add a local perl module to get year last changed 2021-03-31 13:59:53 +02:00
d2i_param.c Update copyright year 2021-06-17 13:24:59 +01:00
d2i_pr.c Copyright year updates 2023-09-07 09:59:15 +01:00
d2i_pu.c Update copyright year 2022-05-03 13:34:51 +01:00
evp_asn1.c Avoid invoking memcpy if size is zero or the supplied buffer is NULL 2021-08-25 17:02:37 +02:00
f_int.c crypto: factorize to hex chars conversion code. 2024-08-07 19:25:10 +02:00
f_string.c crypto: factorize to hex chars conversion code. 2024-08-07 19:25:10 +02:00
i2d_evp.c Copyright year updates 2023-09-07 09:59:15 +01:00
n_pkey.c Update copyright year 2021-06-17 13:24:59 +01:00
nsseq.c
p5_pbe.c Copyright year updates 2023-09-07 09:59:15 +01:00
p5_pbev2.c Implementation of the RFC 9579, PBMAC1 in PKCS#12 2024-08-07 10:00:16 +02:00
p5_scrypt.c Copyright year updates 2023-09-07 09:59:15 +01:00
p8_pkey.c
standard_methods.h fix: drop DSA <=> dsaWithSHA1 aliasing 2024-07-12 11:20:23 +02:00
t_bitst.c
t_pkey.c
t_spki.c Update copyright year 2021-09-07 13:35:43 +02:00
tasn_dec.c Copyright year updates 2024-04-09 13:43:26 +02:00
tasn_enc.c Stop raising ERR_R_MALLOC_FAILURE in most places 2022-10-05 14:02:03 +02:00
tasn_fre.c Fix unpredictible refcount handling of d2i functions 2024-08-16 10:07:52 +02:00
tasn_new.c Stop raising ERR_R_MALLOC_FAILURE in most places 2022-10-05 14:02:03 +02:00
tasn_prn.c Stop raising ERR_R_MALLOC_FAILURE in most places 2022-10-05 14:02:03 +02:00
tasn_scn.c Stop raising ERR_R_MALLOC_FAILURE in most places 2022-10-05 14:02:03 +02:00
tasn_typ.c
tasn_utl.c Copyright year updates 2023-09-07 09:59:15 +01:00
tbl_standard.h Update copyright year 2020-10-15 14:10:06 +01:00
x_algor.c Update copyright year 2022-05-03 13:34:51 +01:00
x_bignum.c
x_info.c Stop raising ERR_R_MALLOC_FAILURE in most places 2022-10-05 14:02:03 +02:00
x_int64.c Cast values to match printf format strings. 2022-11-14 07:47:53 +00:00
x_long.c Convert all {NAME}err() in crypto/ to their corresponding ERR_raise() call 2020-11-13 09:35:02 +01:00
x_pkey.c Stop raising ERR_R_MALLOC_FAILURE in most places 2022-10-05 14:02:03 +02:00
x_sig.c
x_spki.c
x_val.c