MCPcopy Create free account
hub / github.com/dobin/SuperMega / remove_trailing_null_bytes

Function remove_trailing_null_bytes

pe/pehelper.py:87–91  ·  view source on GitHub ↗
(data: bytes)

Source from the content-addressed store, hash-verified

85## Utils
86
87def remove_trailing_null_bytes(data: bytes) -> bytes:
88 for i in range(len(data) - 1, -1, -1):
89 if data[i] != b'\x00'[0]: # Check for a non-null byte
90 return data[:i + 1]
91 return b'' # If the entire sequence is null bytes
92
93
94def align_to_page_size(rva, offset, page_size=4096):

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected