Skip to content

Commit 85affe4

Browse files
committed
Land rapid7#2089, smb last_filename can be nil
2 parents 56ffa4a + add294d commit 85affe4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/rex/proto/smb/client.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1881,7 +1881,7 @@ def find_first(path)
18811881
'C'+ # Short File Name Length
18821882
'C' # Reserved
18831883
)
1884-
name = resp_data[didx + 70 + 24, info[15]].sub!(/\x00+$/, '')
1884+
name = resp_data[didx + 70 + 24, info[15]].sub(/\x00+$/, '')
18851885
files[name] =
18861886
{
18871887
'type' => ((info[14] & 0x10)==0x10) ? 'D' : 'F',
@@ -1916,7 +1916,7 @@ def find_next(sid, resume_key, last_filename)
19161916
260, # Level of interest
19171917
resume_key, # Resume key from previous (Last name offset)
19181918
6, # Close search if end of search
1919-
].pack('vvvVv') + last_filename + "\x00" # Last filename returned from find_first or find_next
1919+
].pack('vvvVv') + last_filename.to_s + "\x00" # Last filename returned from find_first or find_next
19201920
resp = trans2(CONST::TRANS2_FIND_NEXT2, parm, '')
19211921
return resp # Returns the FIND_NEXT2 response packet for parsing by the find_first function
19221922
end

0 commit comments

Comments
 (0)