mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/etc/etc.c (etc_systmpdir): assume system default tmpdir
safe. [ruby-dev:42089] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e7ab96f6ed
commit
9e39c618da
3 changed files with 14 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Fri Sep 10 07:29:14 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/etc/etc.c (etc_systmpdir): assume system default tmpdir
|
||||||
|
safe. [ruby-dev:42089]
|
||||||
|
|
||||||
Fri Sep 10 07:03:23 2010 Tanaka Akira <akr@fsij.org>
|
Fri Sep 10 07:03:23 2010 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* ext/pathname/pathname.c (path_size_p): Pathname#size? translated from
|
* ext/pathname/pathname.c (path_size_p): Pathname#size? translated from
|
||||||
|
|
|
@ -584,14 +584,17 @@ etc_sysconfdir(VALUE obj)
|
||||||
static VALUE
|
static VALUE
|
||||||
etc_systmpdir(void)
|
etc_systmpdir(void)
|
||||||
{
|
{
|
||||||
|
VALUE tmpdir;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
WCHAR path[_MAX_PATH];
|
WCHAR path[_MAX_PATH];
|
||||||
UINT len = rb_w32_system_tmpdir(path, numberof(path));
|
UINT len = rb_w32_system_tmpdir(path, numberof(path));
|
||||||
if (!len) return Qnil;
|
if (!len) return Qnil;
|
||||||
return rb_w32_conv_from_wchar(path, rb_filesystem_encoding());
|
tmpdir = rb_w32_conv_from_wchar(path, rb_filesystem_encoding());
|
||||||
#else
|
#else
|
||||||
return rb_filesystem_str_new_cstr("/tmp");
|
tmpdir = rb_filesystem_str_new_cstr("/tmp");
|
||||||
#endif
|
#endif
|
||||||
|
FL_UNSET(tmpdir, FL_TAINT|FL_UNTRUSTED);
|
||||||
|
return tmpdir;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -30,6 +30,10 @@ class TestTempfile < Test::Unit::TestCase
|
||||||
def test_saves_in_dir_tmpdir_by_default
|
def test_saves_in_dir_tmpdir_by_default
|
||||||
t = tempfile("foo")
|
t = tempfile("foo")
|
||||||
assert_equal Dir.tmpdir, File.dirname(t.path)
|
assert_equal Dir.tmpdir, File.dirname(t.path)
|
||||||
|
bug3733 = '[ruby-dev:42089]'
|
||||||
|
assert_nothing_raised(SecurityError, bug3733) {
|
||||||
|
proc {$SAFE = 1; File.expand_path(Dir.tmpdir)}.call
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_saves_in_given_directory
|
def test_saves_in_given_directory
|
||||||
|
|
Loading…
Add table
Reference in a new issue