mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-09-14 09:46:39 +00:00
Fix ADVERT_PATH parsing of zero bytes
Preserve valid 0x00 bytes in ADVERT_PATH data by reading the exact number of path bytes instead of stripping all zero bytes.
This commit is contained in:
@@ -149,7 +149,8 @@ class MessageReader:
|
||||
else:
|
||||
r["path_hash_mode"] = plen >> 6 # 2 upper bytes
|
||||
r["path_len"] = plen & 0x3F
|
||||
r["path"] = dbuf.read().replace(b"\0", b"").hex()
|
||||
path_byte_count = r["path_len"] * (r["path_hash_mode"] + 1)
|
||||
r["path"] = dbuf.read(path_byte_count).hex()
|
||||
|
||||
await self.dispatcher.dispatch(Event(EventType.ADVERT_PATH, r))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user