avoid stack overflow on too many empty pipe reads in a row
parent
2856c46199
commit
3b228b0abd
|
@ -29,7 +29,7 @@ module Rex::Proto::SMB
|
|||
client.close(file_id, tree_id)
|
||||
end
|
||||
|
||||
def read_ruby_smb(length, offset)
|
||||
def read_ruby_smb(length, offset, depth = 0)
|
||||
if length.nil?
|
||||
max_size = client.open_files[client.last_file_id].size
|
||||
fptr = offset
|
||||
|
@ -50,8 +50,8 @@ module Rex::Proto::SMB
|
|||
begin
|
||||
data = client.read(file_id, offset, length).pack('C*')
|
||||
rescue RubySMB::Error::UnexpectedStatusCode => e
|
||||
if e.message == 'STATUS_PIPE_EMPTY'
|
||||
data = read_ruby_smb(length, offset)
|
||||
if e.message == 'STATUS_PIPE_EMPTY' && depth < 2
|
||||
data = read_ruby_smb(length, offset, depth + 1)
|
||||
else
|
||||
raise e
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue