Consider cap len when forwarding into packet analysis.

When forwarding into packet analysis from TCP or UDP, the protocol's
length fields were trusted. This might be dangerous in case of truncated
packets.
This commit is contained in:
Jan Grashoefer 2023-03-30 15:47:01 +02:00
parent 136d54a68e
commit fb2042ca76
3 changed files with 6 additions and 4 deletions

View file

@ -125,7 +125,7 @@ void TCPAnalyzer::DeliverPacket(Connection* c, double t, bool is_orig, int remai
pkt->session = c;
// Send the packet back into the packet analysis framework.
ForwardPacket(len, data, pkt);
ForwardPacket(std::min(len, remaining), data, pkt);
// Call DeliverPacket on the adapter directly here. Normally we'd call ForwardPacket
// but this adapter does some other things in its DeliverPacket with the packet children