[macruby-changes] [4513] MacRuby/trunk/ext/openssl/ossl_rand.c

source_changes at macosforge.org source_changes at macosforge.org
Mon Sep 13 21:40:28 PDT 2010


Revision: 4513
          http://trac.macosforge.org/projects/ruby/changeset/4513
Author:   lsansonetti at apple.com
Date:     2010-09-13 21:40:27 -0700 (Mon, 13 Sep 2010)
Log Message:
-----------
omg another openssl crasher

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

Modified: MacRuby/trunk/ext/openssl/ossl_rand.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_rand.c	2010-09-14 01:28:43 UTC (rev 4512)
+++ MacRuby/trunk/ext/openssl/ossl_rand.c	2010-09-14 04:40:27 UTC (rev 4513)
@@ -120,8 +120,9 @@
     VALUE str;
     int n = NUM2INT(len);
 
-    str = rb_str_new(0, n);
-    if (!RAND_pseudo_bytes((unsigned char *)RSTRING_PTR(str), n)) {
+    str = rb_bstr_new();
+    rb_bstr_resize(str, n);
+    if (!RAND_pseudo_bytes((unsigned char *)rb_bstr_bytes(str), n)) {
 	ossl_raise(eRandomError, NULL);
     }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100913/8fd58563/attachment.html>


More information about the macruby-changes mailing list