1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
gotoyuzo 2004-12-21 05:40:23 +00:00
parent 3ded769c39
commit a8fee4c9bb
2 changed files with 10 additions and 5 deletions

View file

@ -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

View file

@ -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);