mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-04-20 22:13:49 +00:00
G1: F11 — replace broken except e: in ALLOWED_REPEAT_FREQ handler
Why: The ALLOWED_REPEAT_FREQ branch in handle_rx had `except e:` —
syntactically valid Python only if `e` happens to be bound to an
exception class, which it isn't. The first time the inner read loop
actually raised, the except clause itself would raise NameError
("name 'e' is not defined") and propagate out of the handler. The
proposal correctly notes this is unreachable in practice today
because `int.from_bytes(b"", ...)` returns 0 so the loop terminates
cleanly, but it is a latent footgun. Replace with the standard
`except Exception as e:` form and swap the `print(e)` for a proper
`logger.warning(...)` call to match the rest of the file (which uses
the module logger, not stdout).
Refs: Forensics report finding F11 (S3)
This commit is contained in:
parent
2025cb5326
commit
a7e257c78d
1 changed files with 2 additions and 2 deletions
|
|
@ -717,8 +717,8 @@ class MessageReader:
|
|||
cont = False
|
||||
else:
|
||||
freqs.append({"min" : min, "max": max})
|
||||
except e:
|
||||
print(e)
|
||||
except Exception as e:
|
||||
logger.warning(f"Error parsing ALLOWED_REPEAT_FREQ payload: {e}")
|
||||
|
||||
res["freqs"] = freqs
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue