diff --git a/scapy/contrib/automotive/bmw/hsfz.py b/scapy/contrib/automotive/bmw/hsfz.py index 3ac60a5ed01..adb8f0412af 100644 --- a/scapy/contrib/automotive/bmw/hsfz.py +++ b/scapy/contrib/automotive/bmw/hsfz.py @@ -65,7 +65,7 @@ class HSFZ(Packet): ConditionalField( StrFixedLenField("identification_string", None, None, lambda p: p.length), - lambda p: p.control == 0x11) + lambda p: p.control == 0x11 and p.length != 0) ] def hashret(self): diff --git a/test/contrib/automotive/bmw/hsfz.uts b/test/contrib/automotive/bmw/hsfz.uts index 6b0608dbc03..a1d882a095f 100644 --- a/test/contrib/automotive/bmw/hsfz.uts +++ b/test/contrib/automotive/bmw/hsfz.uts @@ -88,6 +88,11 @@ assert pkt.length == 50 assert pkt.control == 0x11 assert b"BMW" in pkt.identification_string +pkt = UDP(hex_bytes("e9811a9b000ea98f000000000011")) +assert pkt.length == 0 +assert pkt.control == 0x11 + + = Test HSFZSocket