]> git.ipfire.org Git - thirdparty/openssl.git/commit
free oaep label-octet-string on error
authorJames Muir <james@openssl.org>
Wed, 25 Oct 2023 00:08:54 +0000 (20:08 -0400)
committerHugo Landau <hlandau@openssl.org>
Mon, 30 Oct 2023 07:59:06 +0000 (07:59 +0000)
commit83efd7170bfa48a3263fcf8c771a6029646e8ad2
tree1ced4f1f159bda60d34053a74234c45c62cb3147
parent87bed01bdbd827904816130e92e2f8945ba9b99b
free oaep label-octet-string on error

When successful, ossl_X509_ALGOR_from_nid() returns a pointer to an
X509_ALGOR object.  Inside ossl_X509_ALGOR_from_nid(),
X509_ALGOR_set0() is called, and this passes ownership of the ASN1
object "los" (label octet string) to the X509_ALGOR object.  When
ossl_X509_ALGOR_from_nid() fails, ownership has not been passed on and
we need to free "los".

Change the scope of "los" and ensure it is freed on failure (on
success, set it to NULL so it is not freed inside the function).

Fixes #22336

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22495)
crypto/cms/cms_rsa.c