From: Ian Jackson Date: Tue, 18 Jun 2019 17:41:27 +0000 (+0100) Subject: mtu: Discard over-mtu packets X-Git-Tag: hippotat/1.0.0~55^2~1 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=03c02c85656280802dffebcace1698877e89aa60;p=hippotat.git mtu: Discard over-mtu packets There is no authentication of packet data. Bad captive portals etc. can send garbage bad enough to overflow the mtu and cause the client to crash. Signed-off-by: Ian Jackson --- diff --git a/hippotatlib/__init__.py b/hippotatlib/__init__.py index 6423ba3..91696b1 100644 --- a/hippotatlib/__init__.py +++ b/hippotatlib/__init__.py @@ -232,6 +232,7 @@ class SlipStreamDecoder(): self._buffer = b'' self._on_packet = on_packet self._desc = desc + self._mtu = mtu self._log('__init__') def _log(self, msg, **kwargs): @@ -249,7 +250,7 @@ class SlipStreamDecoder(): def _maybe_packet(self, packet): self._log('maybepacket', d=packet) - if len(packet): + if len(packet) and len(packet) <= self._mtu: self._on_packet(packet) def flush(self):