Skip to content

Commit

Permalink
Fix an issue with SMB2 create context padding
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroSteiner committed Nov 3, 2023
1 parent 5c0e90b commit 45dab26
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/ruby_smb/smb2/create_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ def build_buffer
def calc_buffer_size
align = 8
size = 0
size += name_length + ((align - name_length % align) % align)
size += data_length + ((align - data_length % align) % align)
size += name_length
size += ((align - size % align) % align) if name_offset < data_offset
size += data_length
size += ((align - size % align) % align) if data_offset < name_offset
size += ((align - size % align) % align) if next_offset != 0
size
end

Expand Down

0 comments on commit 45dab26

Please sign in to comment.