Skip to content

Commit

Permalink
Enforce Padding for XBin Comment Blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
SE2Dev committed Jan 14, 2018
1 parent 8ef3a7e commit 5e984d0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions xbin.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,9 @@ def WriteMetaVec4Block(file, _hash, vec):

@staticmethod
def WriteCommentBlock(file, comment):
comment = bytearray(comment.encode('utf-8'))
data = struct.pack('Hxx%ds' % (len(comment) + 1), 0xC355, comment)
comment = __str_packable__(comment)
padded_size = padded(len(comment) + 1)
data = struct.pack('Hxx%ds' % padded_size, 0xC355, comment)
file.write(data)

@staticmethod
Expand Down

0 comments on commit 5e984d0

Please sign in to comment.