]> 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:08:59 +0000 (10:08 +0200)
commit9577662515c30910595882e6c15d7d8295fb485c
tree1712aebaf405571e2de39079ec01b47f14318349
parentebb35f19fbdf61cce0f13f7af8a7238aec0d1dd3
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)

(cherry picked from commit d550d2aae531c6fa2e10b1a30d2acdf373663889)
crypto/asn1/tasn_fre.c
test/crltest.c