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
This commit is contained in:
parent
84fa14aab1
commit
7085db45e4
@ -1,3 +1,7 @@
|
|||||||
|
Fri Oct 12 18:18:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* file.c (rb_get_path_check): path name must not contain NUL bytes.
|
||||||
|
|
||||||
Fri Oct 12 16:06:20 2012 NAKAMURA Usaku <usa@ruby-lang.org>
|
Fri Oct 12 16:06:20 2012 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* tool/merger.rb: now can merge revision(s) without --ticket again.
|
* tool/merger.rb: now can merge revision(s) without --ticket again.
|
||||||
|
3
file.c
3
file.c
@ -184,6 +184,9 @@ rb_get_path_check(VALUE obj, int level)
|
|||||||
rb_raise(rb_eEncCompatError, "path name must be ASCII-compatible (%s): %s",
|
rb_raise(rb_eEncCompatError, "path name must be ASCII-compatible (%s): %s",
|
||||||
rb_enc_name(enc), RSTRING_PTR(tmp));
|
rb_enc_name(enc), RSTRING_PTR(tmp));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StringValueCStr(tmp);
|
||||||
|
|
||||||
return rb_str_new4(tmp);
|
return rb_str_new4(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,4 +349,14 @@ class TestFile < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
end
|
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
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user