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:
Matthew Wolter 2026-04-11 18:17:17 -07:00
parent 2025cb5326
commit a7e257c78d

View file

@ -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