From a7e257c78d27d3eba873d028fe91668deae7fb63 Mon Sep 17 00:00:00 2001 From: Matthew Wolter Date: Sat, 11 Apr 2026 18:17:17 -0700 Subject: [PATCH] =?UTF-8?q?G1:=20F11=20=E2=80=94=20replace=20broken=20`exc?= =?UTF-8?q?ept=20e:`=20in=20ALLOWED=5FREPEAT=5FFREQ=20handler?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- src/meshcore/reader.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/meshcore/reader.py b/src/meshcore/reader.py index 4e47e77..581853a 100644 --- a/src/meshcore/reader.py +++ b/src/meshcore/reader.py @@ -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