From 4f5435dac41652ffa0130a20c0cc3fdb1414f3b1 Mon Sep 17 00:00:00 2001 From: aamine Date: Fri, 8 Oct 2004 12:37:19 +0000 Subject: * lib/fileutils.rb (fu_traverse): return value of Dir.entries is reliable. (pass $SAFE=1) * lib/fileutils.rb (remove_dir): return value of Dir.foreach is reliable. (pass $SAFE=1) git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/fileutils.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/fileutils.rb b/lib/fileutils.rb index 08e21a07d..20177a048 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -385,7 +385,7 @@ module FileUtils if st.directory? and (deref or not st.symlink?) stack.concat Dir.entries("#{prefix}/#{rel}")\ .reject {|ent| ent == '.' or ent == '..' }\ - .map {|ent| "#{rel}/#{ent}" }.reverse + .map {|ent| "#{rel}/#{ent.untaint}" }.reverse end yield rel, deref, st deref = false @@ -692,8 +692,8 @@ module FileUtils def remove_dir(dir, force = false) #:nodoc: Dir.foreach(dir) do |file| - next if /\A\.\.?\z/ === file - path = "#{dir}/#{file}" + next if /\A\.\.?\z/ =~ file + path = "#{dir}/#{file.untaint}" if File.symlink?(path) remove_file path, force elsif File.directory?(path) -- cgit