diff --git a/ChangeLog b/ChangeLog index 9856ff0954..4294123cea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Fri Oct 8 21:36:56 2004 Minero Aoki + + * 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) + Fri Oct 8 09:49:32 2004 Yukihiro Matsumoto * pack.c (pack_pack): pointer modification check before each diff --git a/lib/fileutils.rb b/lib/fileutils.rb index 08e21a07d2..20177a048c 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)