mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-06-11 03:56:16 +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:
@@ -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 :
|
||||
|
||||
Reference in New Issue
Block a user