Revision
4513
Author
lsansonetti@apple.com
Date
2010-09-13 21:40:27 -0700 (Mon, 13 Sep 2010)

Log Message

omg another openssl crasher

Modified Paths

Diff

Modified: MacRuby/trunk/ext/openssl/ossl_rand.c (4512 => 4513)


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