From b12a9cfb59c4978d773cc13eee7987cc49c741b4 Mon Sep 17 00:00:00 2001 From: usa Date: Fri, 12 Oct 2012 09:22:06 +0000 Subject: merge revision(s) 37163: * file.c (rb_get_path_check): path name must not contain NUL bytes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@37164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_file.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb index 26f68df958..b888233bbe 100644 --- a/test/ruby/test_file.rb +++ b/test/ruby/test_file.rb @@ -260,4 +260,14 @@ class TestFile < Test::Unit::TestCase assert_equal(File.chmod(0666, file), 1, bug5671) end end + + def test_open_nul + Dir.mktmpdir(__method__.to_s) do |tmpdir| + path = File.join(tmpdir, "foo") + assert_raise(ArgumentError) do + open(path + "\0bar", "w") {} + end + refute File.exist?(path) + end + end end -- cgit v1.2.3