diff --git a/squinnondation/messages.py b/squinnondation/messages.py index 56694fd..0f31845 100644 --- a/squinnondation/messages.py +++ b/squinnondation/messages.py @@ -301,6 +301,12 @@ class DataTLV(TLV): "You are not my neighbour, I don't listen to your DataTLV. Please say me Hello before."))) return + if 0 in self.data: + user.send_packet(sender, Packet.construct(WarningTLV.construct( + f"The length of your DataTLV mismatches. You told me that the length is {len(self.data)} " + f"while a zero was found at index {self.data.index(0)}."))) + self.data = self.data[:self.data.index(0)] + msg = self.data.decode('UTF-8') # Acknowledge the packet