Add padding on packed attributes.
This commit is contained in:
@@ -127,9 +127,14 @@ class Attribute(object):
|
|||||||
sub_parser = self._attributes[attrtype][1]
|
sub_parser = self._attributes[attrtype][1]
|
||||||
sub_accumulator = Accumulator()
|
sub_accumulator = Accumulator()
|
||||||
sub_parser.Pack(sub_accumulator, value)
|
sub_parser.Pack(sub_accumulator, value)
|
||||||
self._nlattr.Pack(accumulator, len=self._nlattr.size + len(sub_accumulator), type=attrtype)
|
attrlen = self._nlattr.size + len(sub_accumulator)
|
||||||
|
self._nlattr.Pack(accumulator, len=attrlen, type=attrtype)
|
||||||
accumulator.Append(str(sub_accumulator))
|
accumulator.Append(str(sub_accumulator))
|
||||||
|
|
||||||
|
padding = ((attrlen + 4 - 1) & ~3) - attrlen
|
||||||
|
if padding:
|
||||||
|
accumulator.Append('\0' * padding)
|
||||||
|
|
||||||
|
|
||||||
class Attributes(object):
|
class Attributes(object):
|
||||||
def __init__(self, attributes):
|
def __init__(self, attributes):
|
||||||
|
|||||||
Reference in New Issue
Block a user