]> git.ipfire.org Git - thirdparty/openssl.git/commit
Fix NULL pointer access caused by X509_ATTRIBUTE_create()
authorIngo Schwarze <schwarze@openbsd.org>
Thu, 4 Jun 2020 22:30:00 +0000 (00:30 +0200)
committerTomas Mraz <tmraz@fedoraproject.org>
Mon, 21 Dec 2020 14:25:59 +0000 (15:25 +0100)
commitc4b2c53fadb158bee34aef90d5a7d500aead1f70
tree3056daff3261143db74fa1aa3cde12c68a296c24
parent7a7ed5fc7978309c997804e174914a037777d786
Fix NULL pointer access caused by X509_ATTRIBUTE_create()

When X509_ATTRIBUTE_create() receives an invalid NID (e.g., -1), return
failure rather than silently constructing a broken X509_ATTRIBUTE object
that might cause NULL pointer accesses later on.  This matters because
X509_ATTRIBUTE_create() is used by API functions like PKCS7_add_attribute(3)
and the NID comes straight from the user.

This bug was found while working on LibreSSL documentation.

Reviewed-by: Theo Buehler <tb@openbsd.org>
CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/12052)
crypto/x509/x_attrib.c