Skip to content

Commit 4fd08b0

Browse files
Testzero-wzT3stzer0
and
T3stzer0
authored
fix packing error (#2040)
Co-authored-by: T3stzer0 <testzerowz@gmail.com>
1 parent 8dd566b commit 4fd08b0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pwnlib/filepointer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ def __bytes__(self):
193193
if isinstance(self.__getattr__(val), bytes):
194194
structure += self.__getattr__(val).ljust(context.bytes, b'\x00')
195195
else:
196-
structure += pack(self.__getattr__(val), self.length[val]*8)
196+
if self.length[val] > 0:
197+
structure += pack(self.__getattr__(val), self.length[val]*8)
197198
return structure
198199

199200
def struntil(self,v):

0 commit comments

Comments
 (0)