diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-23 04:49:40 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-23 04:49:40 +0000 |
commit | 396a07307e4180f218958ffc4edf116b6bbc93e1 (patch) | |
tree | 09df0b87580b99d59c76a867125d37459d35b770 /random.c | |
parent | 176061e317b0285908fa360d8b28b6e0c6bb202a (diff) |
merge revision(s) 31655:
* eval.c (rb_thread_atfork): When a ruby process forks, its random
seed shall be reinitialized to prevent CVE-2003-0900 situation.
This bug affects for 1.8 and earlier series, but not for 1.9.
fixed [ruby-core:34944].
* io.c (pipe_open): ditto.
* random.c (rb_reset_random_seed): ditto.
* intern.h (rb_reset_random_seed): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@31655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Signed-off-by: URABE, Shyouhei <shyouhei@ruby-lang.org>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@31713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'random.c')
-rw-r--r-- | random.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -491,9 +491,15 @@ rb_f_rand(argc, argv, obj) } void -Init_Random() +rb_reset_random_seed() { rand_init(random_seed()); +} + +void +Init_Random() +{ + rb_reset_random_seed(); rb_define_global_function("srand", rb_f_srand, -1); rb_define_global_function("rand", rb_f_rand, -1); rb_global_variable(&saved_seed); |