Fix filename buffer size calcuation in CreateRequest
TJ Harris
3 years ago
369 | 369 | |
370 | 370 | def prepare(self, message): |
371 | 371 | buf = self.filename.encode('UTF-16LE') |
372 | buf_len = len(buf) | |
372 | 373 | if self.create_context_data: |
373 | 374 | n = SMB2Message.HEADER_SIZE + self.STRUCTURE_SIZE + len(buf) |
374 | 375 | if n % 8 != 0: |
396 | 397 | self.create_disp, |
397 | 398 | self.create_options, |
398 | 399 | SMB2Message.HEADER_SIZE + self.STRUCTURE_SIZE, # NameOffset |
399 | len(self.filename)*2, # NameLength in bytes | |
400 | buf_len, # Length of encoded filename in bytes | |
400 | 401 | create_context_offset, # CreateContextOffset |
401 | 402 | len(self.create_context_data) # CreateContextLength |
402 | 403 | ) + buf |