Skip to content

Commit

Permalink
Fix loading binary modules on Windows
Browse files Browse the repository at this point in the history
[#36737359, #36401509]

Failed to follow HACKING guideline #5, open files in binary mode, so
Pro modules were being truncated on Windows installs.
  • Loading branch information
limhoff-r7 committed Oct 8, 2012
1 parent e9b70a3 commit ef6dad2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/msf/core/modules/loader/directory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ def module_path(parent_path, type, module_reference_name)
def read_module_content(parent_path, type, module_reference_name)
full_path = module_path(parent_path, type, module_reference_name)

::File.read(full_path)
module_content = ''

# force to read in binary mode so Pro modules won't be truncated on Windows
File.open(full_path, 'rb') do |f|
module_content = f.read
end

module_content
end
end

0 comments on commit ef6dad2

Please sign in to comment.