Skip to content

Commit 4ca2ce3

Browse files
committed
use synchronous calls to open, read and close (as the async calls were not being waited on, so moving to the sync implmentations of these avoids that problem), thanks @cdelafuente-r7 :)
1 parent 0b6d305 commit 4ca2ce3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

modules/auxiliary/gather/progress_moveit_sftp_fileread_cve_2024_5806.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ def run
160160
end
161161

162162
def read_file(sftp, file_path)
163-
sftp.open(file_path) do |open_response|
163+
sftp.open!(file_path) do |open_response|
164164
if open_response.ok?
165165
file_size = sftp.fstat!(open_response[:handle]).size
166166

167-
sftp.read(open_response[:handle], 0, file_size) do |read_response|
167+
sftp.read!(open_response[:handle], 0, file_size) do |read_response|
168168
if read_response.ok?
169169

170170
file_data = read_response[:data].to_s
@@ -192,7 +192,7 @@ def read_file(sftp, file_path)
192192
print_error('SFTP open failed. Is the TARGETFILE path correct?')
193193
end
194194
ensure
195-
sftp.close(open_response[:handle]) if open_response.ok?
195+
sftp.close!(open_response[:handle]) if open_response.ok?
196196
end
197197
end
198198

0 commit comments

Comments
 (0)