diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-05-12 23:30:09 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2016-05-14 20:00:56 +0900 |
commit | 9fc7a2a1206d5bfe85dff9e01f8a102fb38d2153 (patch) | |
tree | f201d7e01bb935d09f43142d727b33611ab475b7 /ext/openssl | |
parent | f2e3ad91380f799e1650c38b5bd6c24b7ed6fc5b (diff) | |
download | ruby-9fc7a2a1206d5bfe85dff9e01f8a102fb38d2153.tar.gz |
ext/openssl: check argument type in OpenSSL::X509::Attribute#value=
The following code causes SEGV:
OpenSSL::X509::Attribute.new("challengePassword", nil)
* ext/openssl/ossl_x509attr.c (ossl_x509attr_set_value): check that the
argument is an instance of OpenSSL::ASN1::Data, before
ossl_asn1_get_asn1type().
* test/openssl/test_x509attr.rb: add tests
Diffstat (limited to 'ext/openssl')
-rw-r--r-- | ext/openssl/ossl_x509attr.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/ext/openssl/ossl_x509attr.c b/ext/openssl/ossl_x509attr.c index d0f41c6bb8..be5f2dcf88 100644 --- a/ext/openssl/ossl_x509attr.c +++ b/ext/openssl/ossl_x509attr.c @@ -196,6 +196,7 @@ ossl_x509attr_set_value(VALUE self, VALUE value) X509_ATTRIBUTE *attr; ASN1_TYPE *a1type; + OSSL_Check_Kind(value, cASN1Data); if(!(a1type = ossl_asn1_get_asn1type(value))) ossl_raise(eASN1Error, "could not get ASN1_TYPE"); if(ASN1_TYPE_get(a1type) == V_ASN1_SEQUENCE){ |