diff options
| author | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-21 03:44:17 +0000 |
|---|---|---|
| committer | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-21 03:44:17 +0000 |
| commit | 977b19107d291a457e5909d1eb3cf6cfb8bb2e55 (patch) | |
| tree | 11ef2f0475204af143bd7405c1514338f6d00cac /ext/openssl | |
| parent | 326787d9cdc8df3f85bb95a70276cc2fbafb6805 (diff) | |
| download | ruby-977b19107d291a457e5909d1eb3cf6cfb8bb2e55.tar.gz ruby-977b19107d291a457e5909d1eb3cf6cfb8bb2e55.tar.xz ruby-977b19107d291a457e5909d1eb3cf6cfb8bb2e55.zip | |
* ext/openssl/ossl_asn1.c (ossl_asn1_traverse, ossl_asn1_decode):
use rb_str_new4 to avoid SEGV. fix [ruby-dev:25261]
* test/openssl/test_asn1.rb: add tests for OpenSSL::ASN1.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl')
| -rw-r--r-- | ext/openssl/ossl_asn1.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c index a961c16bc..f353ce9b7 100644 --- a/ext/openssl/ossl_asn1.c +++ b/ext/openssl/ossl_asn1.c @@ -815,11 +815,11 @@ ossl_asn1_traverse(VALUE self, VALUE obj) long offset = 0; obj = ossl_to_der_if_possible(obj); - StringValue(obj); + obj = rb_str_new4(StringValue(obj)); p = RSTRING(obj)->ptr; ossl_asn1_decode0(&p, RSTRING(obj)->len, &offset, 0, 0, 1); - return obj; + return Qnil; } static VALUE @@ -830,7 +830,7 @@ ossl_asn1_decode(VALUE self, VALUE obj) long offset = 0; obj = ossl_to_der_if_possible(obj); - StringValue(obj); + obj = rb_str_new4(StringValue(obj)); p = RSTRING(obj)->ptr; ary = ossl_asn1_decode0(&p, RSTRING(obj)->len, &offset, 0, 1, 0); ret = rb_ary_entry(ary, 0); |
