8000 Fix CVE-2018-1000544 and disable symlinks to avoid other security issues by jdleesmiller · Pull Request #376 · rubyzip/rubyzip · GitHub
[go: up one dir, main page]

Skip to content

Fix CVE-2018-1000544 and disable symlinks to avoid other security issues #376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Aug 31, 2018
Prev Previous commit
Next Next commit
Expand from root rather than current working directory
  • Loading branch information
jdleesmiller committed Aug 26, 2018
commit 8a1de5828658bfa0350c2325f311bd6acad261a2
5 changes: 3 additions & 2 deletions lib/zip/entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ def name_is_directory? #:nodoc:all
def name_safe?
cleanpath = Pathname.new(@name).cleanpath
return false unless cleanpath.relative?
naive_expanded_path = ::File.join(Dir.pwd, cleanpath.to_s)
cleanpath.expand_path.to_s == naive_expanded_path
root = ::File::SEPARATOR
naive_expanded_path = ::File.join(root, cleanpath.to_s)
cleanpath.expand_path(root).to_s == naive_expanded_path
end

def local_entry_offset #:nodoc:all
Expand Down
0