summaryrefslogtreecommitdiff
path: root/lib
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
commit971f2bb7690cf673121b53cdf17b61ab90ee5eca (patch)
tree44dad7dc8de80e5c91404a40b4e4e9eec6f025f7 /lib
parent00499c097f0d62a0389d006b61d766cef0ba14ff (diff)
* lib/securerandom.rb (SecureRandom.random_bytes): return string should
be ASCII-8BIT. [ruby-core:24640] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/securerandom.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/securerandom.rb b/lib/securerandom.rb
index 4a97ff8a78..e1799c0c09 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