[macruby-changes] [4509] MacRuby/trunk/ext/openssl
source_changes at macosforge.org
source_changes at macosforge.org
Sat Sep 11 01:51:55 PDT 2010
Revision: 4509
http://trac.macosforge.org/projects/ruby/changeset/4509
Author: lsansonetti at apple.com
Date: 2010-09-11 01:51:52 -0700 (Sat, 11 Sep 2010)
Log Message:
-----------
fix more openssl crashers
Modified Paths:
--------------
MacRuby/trunk/ext/openssl/ossl_asn1.c
MacRuby/trunk/ext/openssl/ossl_x509ext.c
MacRuby/trunk/ext/openssl/ossl_x509name.c
Modified: MacRuby/trunk/ext/openssl/ossl_asn1.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_asn1.c 2010-09-11 08:42:08 UTC (rev 4508)
+++ MacRuby/trunk/ext/openssl/ossl_asn1.c 2010-09-11 08:51:52 UTC (rev 4509)
@@ -672,7 +672,7 @@
static VALUE
join_der(VALUE enumerable)
{
- VALUE str = rb_str_new(0, 0);
+ VALUE str = rb_bstr_new();
rb_block_call(enumerable, rb_intern("each"), 0, 0, join_der_i, str);
return str;
}
Modified: MacRuby/trunk/ext/openssl/ossl_x509ext.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_x509ext.c 2010-09-11 08:42:08 UTC (rev 4508)
+++ MacRuby/trunk/ext/openssl/ossl_x509ext.c 2010-09-11 08:51:52 UTC (rev 4509)
@@ -281,7 +281,7 @@
if(rb_scan_args(argc, argv, "12", &oid, &value, &critical) == 1){
oid = ossl_to_der_if_possible(oid);
StringValue(oid);
- p = (unsigned char *)RSTRING_PTR(oid);
+ p = (const unsigned char *)RSTRING_PTR(oid);
x = d2i_X509_EXTENSION(&ext, &p, RSTRING_LEN(oid));
DATA_PTR(self) = ext;
if(!x)
@@ -411,8 +411,9 @@
GetX509Ext(obj, ext);
if((len = i2d_X509_EXTENSION(ext, NULL)) <= 0)
ossl_raise(eX509ExtError, NULL);
- str = rb_str_new(0, len);
- p = (unsigned char *)RSTRING_PTR(str);
+ str = rb_bstr_new();
+ rb_bstr_resize(str, len);
+ p = (unsigned char *)rb_bstr_bytes(str);
if(i2d_X509_EXTENSION(ext, &p) < 0)
ossl_raise(eX509ExtError, NULL);
ossl_str_adjust(str, p);
Modified: MacRuby/trunk/ext/openssl/ossl_x509name.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_x509name.c 2010-09-11 08:42:08 UTC (rev 4508)
+++ MacRuby/trunk/ext/openssl/ossl_x509name.c 2010-09-11 08:51:52 UTC (rev 4509)
@@ -139,7 +139,7 @@
VALUE str = ossl_to_der_if_possible(arg);
X509_NAME *x;
StringValue(str);
- p = (unsigned char *)RSTRING_PTR(str);
+ p = (const unsigned char *)RSTRING_PTR(str);
x = d2i_X509_NAME(&name, &p, RSTRING_LEN(str));
DATA_PTR(self) = name;
if(!x){
@@ -321,8 +321,9 @@
GetX509Name(self, name);
if((len = i2d_X509_NAME(name, NULL)) <= 0)
ossl_raise(eX509NameError, NULL);
- str = rb_str_new(0, len);
- p = (unsigned char *)RSTRING_PTR(str);
+ str = rb_bstr_new();
+ rb_bstr_resize(str, len);
+ p = (unsigned char *)rb_bstr_bytes(str);
if(i2d_X509_NAME(name, &p) <= 0)
ossl_raise(eX509NameError, NULL);
ossl_str_adjust(str, p);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100911/8b6bc6e3/attachment.html>
More information about the macruby-changes
mailing list