]> git.ipfire.org Git - thirdparty/openssl.git/commit
Fix unpredictible refcount handling of d2i functions
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Tue, 12 Mar 2024 19:04:56 +0000 (20:04 +0100)
committerTomas Mraz <tomas@openssl.org>
Fri, 16 Aug 2024 08:07:52 +0000 (10:07 +0200)
commitd550d2aae531c6fa2e10b1a30d2acdf373663889
tree8722e0104bbfa7432c70a21a9360a2732fb444d9
parent83951a9979784ffa701e945b86f2f0bc2caead8e
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)
crypto/asn1/tasn_fre.c
test/crltest.c