diff options
| author | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-21 05:40:23 +0000 |
|---|---|---|
| committer | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-21 05:40:23 +0000 |
| commit | 15e358e2a70b3225a952bcc47339c0dd92a19202 (patch) | |
| tree | 744a638f9101badce422368379f471b0aebb561c | |
| parent | 4baa80462e8d1d1b58b3db133a84a3c2b0c6606e (diff) | |
| download | ruby-15e358e2a70b3225a952bcc47339c0dd92a19202.tar.gz ruby-15e358e2a70b3225a952bcc47339c0dd92a19202.tar.xz ruby-15e358e2a70b3225a952bcc47339c0dd92a19202.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/branches/ruby_1_8@7625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 7 | ||||
| -rw-r--r-- | ext/openssl/ossl_asn1.c | 8 |
2 files changed, 10 insertions, 5 deletions
@@ -1,3 +1,10 @@ +Tue Dec 21 14:40:02 2004 GOTOU Yuuzou <gotoyuzo@notwork.org> + + * 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. + Tue Dec 21 12:22:40 2004 Nobuyoshi Nakada <nobu@ruby-lang.org> * io.c (io_reopen): keep duplex pipe in correct mode for exception diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c index abea6f5f0..8b71b8cb6 100644 --- a/ext/openssl/ossl_asn1.c +++ b/ext/openssl/ossl_asn1.c @@ -815,12 +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(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 @@ -831,8 +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(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); |
