Skip to content

Commit 3c0c9fc

Browse files
committed
argv and env in elf loader should be able to accept bytes as argument
1 parent b6cf49a commit 3c0c9fc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

qiling/loader/elf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def __push_str(top: int, s: str) -> int:
308308
Top of stack remains aligned to pointer size
309309
"""
310310

311-
data = s.encode('utf-8') + b'\x00'
311+
data = (s if isinstance(s, bytes) else s.encode("utf-8")) + b'\x00'
312312
top = QlLoaderELF.align(top - len(data), self.ql.pointersize)
313313
self.ql.mem.write(top, data)
314314

@@ -682,4 +682,4 @@ def get_elfdata_mapping(self, elffile: ELFFile) -> bytes:
682682
# aggregate section data
683683
elfdata_mapping.extend(sec.data())
684684

685-
return bytes(elfdata_mapping)
685+
return bytes(elfdata_mapping)

0 commit comments

Comments
 (0)