[macruby-changes] [4503] MacRuby/trunk/ext/openssl

source_changes at macosforge.org source_changes at macosforge.org
Fri Sep 10 00:55:32 PDT 2010


Revision: 4503
          http://trac.macosforge.org/projects/ruby/changeset/4503
Author:   lsansonetti at apple.com
Date:     2010-09-10 00:55:31 -0700 (Fri, 10 Sep 2010)
Log Message:
-----------
fix some openssl crashers

Modified Paths:
--------------
    MacRuby/trunk/ext/openssl/ossl_bn.c
    MacRuby/trunk/ext/openssl/ossl_x509cert.c

Modified: MacRuby/trunk/ext/openssl/ossl_bn.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_bn.c	2010-09-10 07:55:08 UTC (rev 4502)
+++ MacRuby/trunk/ext/openssl/ossl_bn.c	2010-09-10 07:55:31 UTC (rev 4503)
@@ -170,7 +170,7 @@
  * * * * 16 - hex
  */
 static VALUE
-ossl_bn_to_s(int argc, VALUE *argv, VALUE self)
+ossl_bn_to_s(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     BIGNUM *bn;
     VALUE str, bs;
@@ -238,11 +238,11 @@
 }
 
 static VALUE
-ossl_bn_coerce(VALUE self, VALUE other)
+ossl_bn_coerce(VALUE self, SEL sel, VALUE other)
 {
     switch(TYPE(other)) {
     case T_STRING:
-	self = ossl_bn_to_s(0, NULL, self);
+	self = ossl_bn_to_s(self, 0, 0, NULL);
 	break;
     case T_FIXNUM:
     case T_BIGNUM:

Modified: MacRuby/trunk/ext/openssl/ossl_x509cert.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_x509cert.c	2010-09-10 07:55:08 UTC (rev 4502)
+++ MacRuby/trunk/ext/openssl/ossl_x509cert.c	2010-09-10 07:55:31 UTC (rev 4503)
@@ -191,8 +191,9 @@
     GetX509(self, x509);
     if ((len = i2d_X509(x509, NULL)) <= 0)
 	ossl_raise(eX509CertError, NULL);
-    str = rb_str_new(0, len);
-    p = (unsigned char *)RSTRING_PTR(str);
+    str = rb_bstr_new_with_data(0, len);
+    rb_bstr_set_length(str, len);
+    p = (unsigned char *)rb_bstr_bytes(str);
     if (i2d_X509(x509, &p) <= 0)
 	ossl_raise(eX509CertError, NULL);
     ossl_str_adjust(str, p);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100910/e13a810a/attachment.html>


More information about the macruby-changes mailing list