[前][次][番号順一覧][スレッド一覧]

ruby-changes:42920

From: nobu <ko1@a...>
Date: Fri, 13 May 2016 23:56:38 +0900 (JST)
Subject: [ruby-changes:42920] nobu:r54994 (trunk): random.c: clear buf

nobu	2016-05-13 23:56:32 +0900 (Fri, 13 May 2016)

  New Revision: 54994

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54994

  Log:
    random.c: clear buf
    
    * random.c (random_seed): clear temporary buffer explicitly.

  Modified files:
    trunk/random.c
Index: random.c
===================================================================
--- random.c	(revision 54993)
+++ random.c	(revision 54994)
@@ -600,9 +600,12 @@ make_seed_value(const uint32_t *ptr) https://github.com/ruby/ruby/blob/trunk/random.c#L600
 static VALUE
 random_seed(void)
 {
+    VALUE v;
     uint32_t buf[DEFAULT_SEED_CNT];
     fill_random_seed(buf);
-    return make_seed_value(buf);
+    v = make_seed_value(buf);
+    explicit_bzero(buf, DEFAULT_SEED_LEN);
+    return v;
 }
 
 /*

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]