Skip to content

Commit ef6dad2

Browse files
committed
Fix loading binary modules on Windows
[#36737359, #36401509] Failed to follow HACKING guideline #5, open files in binary mode, so Pro modules were being truncated on Windows installs.
1 parent e9b70a3 commit ef6dad2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/msf/core/modules/loader/directory.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ def module_path(parent_path, type, module_reference_name)
7373
def read_module_content(parent_path, type, module_reference_name)
7474
full_path = module_path(parent_path, type, module_reference_name)
7575

76-
::File.read(full_path)
76+
module_content = ''
77+
78+
# force to read in binary mode so Pro modules won't be truncated on Windows
79+
File.open(full_path, 'rb') do |f|
80+
module_content = f.read
81+
end
82+
83+
module_content
7784
end
7885
end

0 commit comments

Comments
 (0)