mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-04-20 22:13:49 +00:00
G4: M06 — add return after oversize-frame state reset
Why: When handle_rx detects an oversize frame header (>300 bytes), it resets state (header, inframe, frame_expected_size) and re-calls itself on any remaining data. But when data is empty after the header, the method fell through to the frame-assembly code with inframe=b"", eventually dispatching an empty frame to reader.handle_rx. Currently absorbed by F06's umbrella try/except, but a guaranteed crash if that guard moves. Adding a bare return after the reset block prevents the fallthrough in both TCP and serial transports. Refs: Forensics report finding M06
This commit is contained in:
parent
d6197dc71e
commit
9150a49c6f
2 changed files with 2 additions and 2 deletions
|
|
@ -106,7 +106,7 @@ class SerialConnection:
|
|||
self.frame_expected_size = 0
|
||||
if len(data) > 0: # rerun handle_rx on remaining data
|
||||
self.handle_rx(data)
|
||||
return
|
||||
return # nothing left to process after reset
|
||||
|
||||
upbound = self.frame_expected_size - len(self.inframe)
|
||||
if len(data) < upbound:
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ class TCPConnection:
|
|||
self.frame_expected_size = 0
|
||||
if len(data) > 0: # rerun handle_rx on remaining data
|
||||
self.handle_rx(data)
|
||||
return
|
||||
return # nothing left to process after reset
|
||||
|
||||
upbound = self.frame_expected_size - len(self.inframe)
|
||||
if len(data) < upbound :
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue