From 5e984d08cfe1a8861e49834853cdce03fa83ada4 Mon Sep 17 00:00:00 2001 From: SE2Dev Date: Fri, 12 Jan 2018 17:26:22 -0500 Subject: [PATCH] Enforce Padding for XBin Comment Blocks --- xbin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xbin.py b/xbin.py index a061262..38ea600 100644 --- a/xbin.py +++ b/xbin.py @@ -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