From 7085db45e4f15a58f9a82c8815bcc31364e0fde1 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 12 Oct 2012 09:18:07 +0000 Subject: file.c: poisoned NUL * file.c (rb_get_path_check): path name must not contain NUL bytes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_file.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/ruby/test_file.rb') diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb index f54e440313..41483cee3a 100644 --- a/test/ruby/test_file.rb +++ b/test/ruby/test_file.rb @@ -349,4 +349,14 @@ class TestFile < Test::Unit::TestCase end 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 + assert_file_not(:exist?, path) + end + end end -- cgit v1.2.3