aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-19 08:32:44 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-19 08:32:44 +0000
commit2737b90e36f43865be74ebf6b71ea3ab42309720 (patch)
tree11936a3d17872dba8c56a5fd9c156bbfa25ef191
parent33fc55acef6a2d7b79cf5ac084bbb94cb3b14b31 (diff)
downloadruby-2737b90e36f43865be74ebf6b71ea3ab42309720.tar.gz
* io.c (io_read): should taint the result. [ruby-dev:38826]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--io.c1
-rw-r--r--test/ruby/test_io.rb6
3 files changed, 11 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index dd6db14858..dffca496cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sun Jul 19 17:32:37 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (io_read): should taint the result. [ruby-dev:38826]
+
Sun Jul 19 11:00:14 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_method.c (me_opts): fixed optimized method aliasing.
diff --git a/io.c b/io.c
index e2de4a69b1..44f79a735f 100644
--- a/io.c
+++ b/io.c
@@ -2114,6 +2114,7 @@ io_read(int argc, VALUE *argv, VALUE io)
return Qnil;
}
rb_str_resize(str, n);
+ OBJ_TAINT(str);
return str;
}
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 42614e00cb..ab893dbfd8 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -1457,4 +1457,10 @@ class TestIO < Test::Unit::TestCase
}
}
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