summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-31 09:03:09 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-31 09:03:09 +0000
commita69167466afeeccdaf8d4f420d91c91c7a3ee49b (patch)
tree44dad7dc8de80e5c91404a40b4e4e9eec6f025f7
parentc8d91dd7a88e4a32247c503340909e3bfe2d3733 (diff)
downloadruby-a69167466afeeccdaf8d4f420d91c91c7a3ee49b.tar.gz
ruby-a69167466afeeccdaf8d4f420d91c91c7a3ee49b.tar.xz
ruby-a69167466afeeccdaf8d4f420d91c91c7a3ee49b.zip
* lib/securerandom.rb (SecureRandom.random_bytes): return string should
be ASCII-8BIT. [ruby-core:24640] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/securerandom.rb2
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index de5d71384..5ce6a305d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Jul 31 18:01:34 2009 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/securerandom.rb (SecureRandom.random_bytes): return string should
+ be ASCII-8BIT. [ruby-core:24640]
+
Fri Jul 31 16:28:33 2009 NARUSE, Yui <naruse@ruby-lang.org>
* io.c (rb_stdio_set_default_encoding): added.
diff --git a/lib/securerandom.rb b/lib/securerandom.rb
index 4a97ff8a7..e1799c0c0 100644
--- a/lib/securerandom.rb
+++ b/lib/securerandom.rb
@@ -104,7 +104,7 @@ module SecureRandom
end
end
if @has_win32
- bytes = " " * n
+ bytes = " ".force_encoding("ASCII-8BIT") * n
if @crypt_gen_random.call(@hProv, bytes.size, bytes) == 0
raise SystemCallError, "CryptGenRandom failed: #{lastWin32ErrorMessage}"
end