diff options
| author | schwarze <> | 2020-06-04 21:21:03 +0000 |
|---|---|---|
| committer | schwarze <> | 2020-06-04 21:21:03 +0000 |
| commit | be3505dc014b9b7022575b6fe4f9c78c2080281c (patch) | |
| tree | 2920ef908eabfe843f01bfd04a3aaf4eff0a1cec /src/lib/libcrypto/man | |
| parent | 249e70083469fe402a1366e4a02f52cb145be012 (diff) | |
| download | openbsd-be3505dc014b9b7022575b6fe4f9c78c2080281c.tar.gz openbsd-be3505dc014b9b7022575b6fe4f9c78c2080281c.tar.bz2 openbsd-be3505dc014b9b7022575b6fe4f9c78c2080281c.zip | |
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 documented API functions like
PKCS7_add_attribute(3) and the NID comes straight from the user.
This fixes a bug found while working on documentation.
OK tb@ and "thanks" bluhm@
Diffstat (limited to 'src/lib/libcrypto/man')
| -rw-r--r-- | src/lib/libcrypto/man/PKCS7_add_attribute.3 | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/lib/libcrypto/man/PKCS7_add_attribute.3 b/src/lib/libcrypto/man/PKCS7_add_attribute.3 index 09c36a4d5d..081703f0f3 100644 --- a/src/lib/libcrypto/man/PKCS7_add_attribute.3 +++ b/src/lib/libcrypto/man/PKCS7_add_attribute.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS7_add_attribute.3,v 1.1 2020/06/04 10:24:27 schwarze Exp $ | 1 | .\" $OpenBSD: PKCS7_add_attribute.3,v 1.2 2020/06/04 21:21:03 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -123,7 +123,9 @@ exist. | |||
| 123 | and | 123 | and |
| 124 | .Fn PKCS7_add_signed_attribute | 124 | .Fn PKCS7_add_signed_attribute |
| 125 | return 1 on success or 0 on failure. | 125 | return 1 on success or 0 on failure. |
| 126 | The most common reason for failure is lack of memory. | 126 | The most common reasons for failure are an invalid |
| 127 | .Fa nid | ||
| 128 | argument or lack of memory. | ||
| 127 | .Pp | 129 | .Pp |
| 128 | .Fn PKCS7_get_attribute | 130 | .Fn PKCS7_get_attribute |
| 129 | and | 131 | and |
| @@ -153,16 +155,6 @@ These functions first appeared in OpenSSL 0.9.1 | |||
| 153 | and have been available since | 155 | and have been available since |
| 154 | .Ox 2.6 . | 156 | .Ox 2.6 . |
| 155 | .Sh BUGS | 157 | .Sh BUGS |
| 156 | Adding an attribute with an invalid | ||
| 157 | .Fa nid | ||
| 158 | ought to fail, but it actually succeeds | ||
| 159 | setting the type of the new attribute to | ||
| 160 | .Dv NULL . | ||
| 161 | Subsequent attempts to retrieve attributes | ||
| 162 | may cause the program to crash due to | ||
| 163 | .Dv NULL | ||
| 164 | pointer access. | ||
| 165 | .Pp | ||
| 166 | A function to remove individual attributes from these lists | 158 | A function to remove individual attributes from these lists |
| 167 | does not appear to exist. | 159 | does not appear to exist. |
| 168 | A program desiring to do that might have to manually iterate the fields | 160 | A program desiring to do that might have to manually iterate the fields |
