The branch master has been updated via 94f4d58a87eac9c6fe4cb46b998656bd6d6f03a5 (commit) via 6335f837cfa7eaf1202f2557bf2ba148987226e7 (commit) from c2969ff6e70b10f71fbd97c1d0b0cffc92bd69df (commit)
- Log ----------------------------------------------------------------- commit 94f4d58a87eac9c6fe4cb46b998656bd6d6f03a5 Author: Bernd Edlinger <bernd.edlin...@hotmail.de> Date: Mon Jul 1 09:41:47 2019 +0200 Check for V_ASN1_BOOLEAN/V_ASN1_NULL in X509_ATTRIBUTE_get0_data The member value.ptr is undefined for those ASN1 types. Reviewed-by: Matt Caswell <m...@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9278) commit 6335f837cfa7eaf1202f2557bf2ba148987226e7 Author: Bernd Edlinger <bernd.edlin...@hotmail.de> Date: Mon Jul 1 09:06:02 2019 +0200 Fix ASN1_TYPE_get/set with type=V_ASN1_BOOLEAN BOOLEAN does not have valid data in the value.ptr member, thus don't use it here. Fixes #9276 [extended tests] Reviewed-by: Matt Caswell <m...@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9278) ----------------------------------------------------------------------- Summary of changes: crypto/asn1/a_type.c | 8 ++++++-- crypto/x509/x509_att.c | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/crypto/asn1/a_type.c b/crypto/asn1/a_type.c index 1584401..9b8810c 100644 --- a/crypto/asn1/a_type.c +++ b/crypto/asn1/a_type.c @@ -15,7 +15,9 @@ int ASN1_TYPE_get(const ASN1_TYPE *a) { - if ((a->value.ptr != NULL) || (a->type == V_ASN1_NULL)) + if (a->type == V_ASN1_BOOLEAN + || a->type == V_ASN1_NULL + || a->value.ptr != NULL) return a->type; else return 0; @@ -23,7 +25,9 @@ int ASN1_TYPE_get(const ASN1_TYPE *a) void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value) { - if (a->value.ptr != NULL) { + if (a->type != V_ASN1_BOOLEAN + && a->type != V_ASN1_NULL + && a->value.ptr != NULL) { ASN1_TYPE **tmp_a = &a; asn1_primitive_free((ASN1_VALUE **)tmp_a, NULL, 0); } diff --git a/crypto/x509/x509_att.c b/crypto/x509/x509_att.c index f1cd9df..317a45a4 100644 --- a/crypto/x509/x509_att.c +++ b/crypto/x509/x509_att.c @@ -314,7 +314,9 @@ void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, ttmp = X509_ATTRIBUTE_get0_type(attr, idx); if (!ttmp) return NULL; - if (atrtype != ASN1_TYPE_get(ttmp)) { + if (atrtype == V_ASN1_BOOLEAN + || atrtype == V_ASN1_NULL + || atrtype != ASN1_TYPE_get(ttmp)) { X509err(X509_F_X509_ATTRIBUTE_GET0_DATA, X509_R_WRONG_TYPE); return NULL; }