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

ruby-changes:12500

From: nobu <ko1@a...>
Date: Sun, 19 Jul 2009 17:33:03 +0900 (JST)
Subject: [ruby-changes:12500] Ruby:r24203 (trunk): * io.c (io_read): should taint the result.

nobu	2009-07-19 17:32:44 +0900 (Sun, 19 Jul 2009)

  New Revision: 24203

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=24203

  Log:
    * io.c (io_read): should taint the result.   [ruby-dev:38826]

  Modified files:
    trunk/ChangeLog
    trunk/io.c
    trunk/test/ruby/test_io.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 24202)
+++ ChangeLog	(revision 24203)
@@ -1,3 +1,7 @@
+Sun Jul 19 17:32:37 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* io.c (io_read): should taint the result.   [ruby-dev:38826]
+
 Sun Jul 19 11:00:14 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* vm_method.c (me_opts): fixed optimized method aliasing.
Index: io.c
===================================================================
--- io.c	(revision 24202)
+++ io.c	(revision 24203)
@@ -2114,6 +2114,7 @@
         return Qnil;
     }
     rb_str_resize(str, n);
+    OBJ_TAINT(str);
 
     return str;
 }
Index: test/ruby/test_io.rb
===================================================================
--- test/ruby/test_io.rb	(revision 24202)
+++ test/ruby/test_io.rb	(revision 24203)
@@ -1457,4 +1457,10 @@
       }
     }
   end
+
+  def test_tainted
+    t = make_tempfile
+    assert(File.read(t.path, 4).tainted?, '[ruby-dev:38826]')
+    assert(File.open(t.path) {|f| f.read(4)}.tainted?, '[ruby-dev:38826]')
+  end
 end

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

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