mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-04-20 22:13:49 +00:00
G1: R02 — fix txt_type empty-slice (uncrypted[4:4] -> [4:5])
`uncrypted[4:4]` is the empty slice. `int.from_bytes(b"", "little")` returns 0, so `txt_type` was always 0 for every decrypted channel message — silently masking the upper 6 bits of byte 4. The line immediately above (`attempt = uncrypted[4] & 3`) already proves byte 4 is in range, so widening the slice to `[4:5]` is safe. This is a one-character fix and changes the observable value of `txt_type` for all callers. Existing consumers that branched on `txt_type` were effectively dead code; this restores the intended behavior. Finding: R02 (Info) File: src/meshcore/meshcore_parser.py
This commit is contained in:
parent
865c1b21b4
commit
1a3a665b17
1 changed files with 1 additions and 1 deletions
|
|
@ -150,7 +150,7 @@ class MeshcorePacketParser:
|
|||
uncrypted = cipher.decrypt(msg)
|
||||
timestamp = int.from_bytes(uncrypted[0:4], "little", signed=False)
|
||||
attempt = uncrypted[4] & 3
|
||||
txt_type = int.from_bytes(uncrypted[4:4], "little", signed=False) >> 2
|
||||
txt_type = int.from_bytes(uncrypted[4:5], "little", signed=False) >> 2
|
||||
message = uncrypted[5:].strip(b"\0")
|
||||
msg_hash = int.from_bytes(SHA256.new(timestamp.to_bytes(4, "little", signed=False) + message).digest()[0:4], "little", signed=False)
|
||||
log_data["message"] = message.decode("utf-8", "ignore")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue