diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2019-07-01 09:06:02 +0200 |
---|---|---|
committer | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2019-07-02 16:22:02 +0200 |
commit | 6335f837cfa7eaf1202f2557bf2ba148987226e7 (patch) | |
tree | c8e0f3b7774eb4491a4041ca9e4d17076f3168ab /crypto/asn1 | |
parent | c2969ff6e70b10f71fbd97c1d0b0cffc92bd69df (diff) |
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 <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9278)
Diffstat (limited to 'crypto/asn1')
-rw-r--r-- | crypto/asn1/a_type.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/crypto/asn1/a_type.c b/crypto/asn1/a_type.c index 158440134d..9b8810cd74 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); } |