1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nobu 2009-07-19 08:32:44 +00:00
parent 33fc55acef
commit 2737b90e36
3 changed files with 11 additions and 0 deletions

View file

@ -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.

1
io.c
View file

@ -2114,6 +2114,7 @@ io_read(int argc, VALUE *argv, VALUE io)
return Qnil;
}
rb_str_resize(str, n);
OBJ_TAINT(str);
return str;
}

View file

@ -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