Brief description
I noticed that the StrLenField of value in MQTTPublish packets is defined as
StrLenField("value", "",
length_from=lambda pkt: (pkt.underlayer.len -
pkt.length - 2)),
However, if the QoS of the publish message is 1 or 2, because of the field of msgid, I guess it should be pkt.underlayer.len - pkt.length - 4, as I met this problem when I was trying to parse a packet that contains two MQTT Publish messages.

I tried to fix it with codes as followed. Perhaps it could help.
StrLenField("value", "",
length_from=lambda pkt: pkt.underlayer.len -pkt.length - 2 if pkt.underlayer.QOS == 0
else pkt.underlayer.len -pkt.length - 4)
Scapy version
2.4.5
Python version
3.8
Operating system
Win11
Additional environment information
No response
How to reproduce
Sniff a packet with two MQTT Publish messages......
Actual result
No response
Expected result
No response
Related resources
No response
Brief description
I noticed that the StrLenField of value in MQTTPublish packets is defined as
However, if the QoS of the publish message is 1 or 2, because of the field of msgid, I guess it should be pkt.underlayer.len - pkt.length - 4, as I met this problem when I was trying to parse a packet that contains two MQTT Publish messages.

I tried to fix it with codes as followed. Perhaps it could help.
Scapy version
2.4.5
Python version
3.8
Operating system
Win11
Additional environment information
No response
How to reproduce
Sniff a packet with two MQTT Publish messages......
Actual result
No response
Expected result
No response
Related resources
No response