[macruby-changes] [5087] MacRuby/trunk/ext/openssl/ossl_pkey_dsa.c

source_changes at macosforge.org source_changes at macosforge.org
Mon Dec 27 18:36:01 PST 2010


Revision: 5087
          http://trac.macosforge.org/projects/ruby/changeset/5087
Author:   watson1978 at gmail.com
Date:     2010-12-27 18:35:55 -0800 (Mon, 27 Dec 2010)
Log Message:
-----------
Fixed the Bus Error within OpenSSL::PKey::DSA#syssign.

Test Script:
{{{
require 'openssl'

dsa = OpenSSL::PKey::DSA.new(512)
p dsa.syssign('foo')
}}}

Modified Paths:
--------------
    MacRuby/trunk/ext/openssl/ossl_pkey_dsa.c

Modified: MacRuby/trunk/ext/openssl/ossl_pkey_dsa.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_pkey_dsa.c	2010-12-27 23:38:05 UTC (rev 5086)
+++ MacRuby/trunk/ext/openssl/ossl_pkey_dsa.c	2010-12-28 02:35:55 UTC (rev 5087)
@@ -396,13 +396,14 @@
     if (!DSA_PRIVATE(self, pkey->pkey.dsa)) {
 	ossl_raise(eDSAError, "Private DSA key needed!");
     }
-    str = rb_str_new(0, ossl_dsa_buf_size(pkey));
+    str = rb_bstr_new();
+    rb_str_resize(str, ossl_dsa_buf_size(pkey));
     if (!DSA_sign(0, (unsigned char *)RSTRING_PTR(data), RSTRING_LEN(data),
-		  (unsigned char *)RSTRING_PTR(str),
+		  (unsigned char *)rb_bstr_bytes(str),
 		  &buf_len, pkey->pkey.dsa)) { /* type is ignored (0) */
 	ossl_raise(eDSAError, NULL);
     }
-    rb_str_set_len(str, buf_len);
+    rb_str_resize(str, buf_len);
 
     return str;
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101227/f6607ada/attachment.html>


More information about the macruby-changes mailing list