Skip to content

Commit 56de4f4

Browse files
hsfz: vehicle ident string is only present in replays with non zero len. (#4757)
1 parent 0022dfd commit 56de4f4

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

scapy/contrib/automotive/bmw/hsfz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class HSFZ(Packet):
6565
ConditionalField(
6666
StrFixedLenField("identification_string",
6767
None, None, lambda p: p.length),
68-
lambda p: p.control == 0x11)
68+
lambda p: p.control == 0x11 and p.length != 0)
6969
]
7070

7171
def _hasaddrs(self):

test/contrib/automotive/bmw/hsfz.uts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ assert pkt.length == 50
106106
assert pkt.control == 0x11
107107
assert b"BMW" in pkt.identification_string
108108

109+
pkt = UDP(hex_bytes("e9811a9b000ea98f000000000011"))
110+
assert pkt.length == 0
111+
assert pkt.control == 0x11
112+
113+
109114
= Test HSFZSocket
110115

111116

0 commit comments

Comments
 (0)